|
Rather than necro this old thread, starting a new one:
http://grails.1312388.n4.nabble.com/GORM-Forcing-an-insert-only-hibernate-save-instead-of-an-update-hibernate-saveOrUpdate-td1748629.html Basically, I have a table with no primary keys and no indexing. It's used for logging structured data. I was trying to figure out why performance was so horrible, when I noticed in the org.hibernate.SQL logs that Hibernate was doing a SELECT before each INSERT. Here's an idea of what my GORM mapping looks like: static mapping = { version false id column: 'NOT_A_PK', generator: 'assigned' column1 column: 'COL_1' etc. } I am calling this with DomainClass.save(insert: true). From the old thread, it looks like under the covers Grails insists on using Hibernate saveOrUpdate() rather than just save()? So, is there some way that I can just do the INSERT, or am I going to have to drop down to native SQL? --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Do you have any constraints that query the database (i.e. unique) ?
|
|
On Thu, Feb 9, 2012 at 12:38 AM, arecibo <[hidden email]> wrote:
> Do you have any constraints that query the database (i.e. unique) ? No. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by Andrew Todd
Bump, it would be nice to have a definitive "no" for documentation's
sake, if nothing else. On Wed, Feb 8, 2012 at 4:20 PM, Andrew Todd <[hidden email]> wrote: > Rather than necro this old thread, starting a new one: > http://grails.1312388.n4.nabble.com/GORM-Forcing-an-insert-only-hibernate-save-instead-of-an-update-hibernate-saveOrUpdate-td1748629.html > > Basically, I have a table with no primary keys and no indexing. It's > used for logging structured data. I was trying to figure out why > performance was so horrible, when I noticed in the org.hibernate.SQL > logs that Hibernate was doing a SELECT before each INSERT. Here's an > idea of what my GORM mapping looks like: > > static mapping = { > version false > id column: 'NOT_A_PK', generator: 'assigned' > column1 column: 'COL_1' > > etc. > } > > I am calling this with DomainClass.save(insert: true). From the old > thread, it looks like under the covers Grails insists on using > Hibernate saveOrUpdate() rather than just save()? > > So, is there some way that I can just do the INSERT, or am I going to > have to drop down to native SQL? --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Administrator
|
Try
obj.save insert:true Cheers On Mon, Feb 13, 2012 at 4:15 PM, Andrew Todd <[hidden email]> wrote: > Bump, it would be nice to have a definitive "no" for documentation's > sake, if nothing else. > > On Wed, Feb 8, 2012 at 4:20 PM, Andrew Todd <[hidden email]> wrote: >> Rather than necro this old thread, starting a new one: >> http://grails.1312388.n4.nabble.com/GORM-Forcing-an-insert-only-hibernate-save-instead-of-an-update-hibernate-saveOrUpdate-td1748629.html >> >> Basically, I have a table with no primary keys and no indexing. It's >> used for logging structured data. I was trying to figure out why >> performance was so horrible, when I noticed in the org.hibernate.SQL >> logs that Hibernate was doing a SELECT before each INSERT. Here's an >> idea of what my GORM mapping looks like: >> >> static mapping = { >> version false >> id column: 'NOT_A_PK', generator: 'assigned' >> column1 column: 'COL_1' >> >> etc. >> } >> >> I am calling this with DomainClass.save(insert: true). From the old >> thread, it looks like under the covers Grails insists on using >> Hibernate saveOrUpdate() rather than just save()? >> >> So, is there some way that I can just do the INSERT, or am I going to >> have to drop down to native SQL? > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > -- Graeme Rocher Grails Project Lead SpringSource - A Division of VMware http://www.springsource.com --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On Mon, Feb 13, 2012 at 11:07 AM, Graeme Rocher <[hidden email]> wrote:
> Try > > obj.save insert:true See original message, in this case specifying insert: true does not seem to help. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Finally got around to creating a demo project and JIRA item for this
problem: http://jira.grails.org/browse/GRAILS-9055 On Mon, Feb 13, 2012 at 12:29 PM, Andrew Todd <[hidden email]> wrote: > On Mon, Feb 13, 2012 at 11:07 AM, Graeme Rocher <[hidden email]> wrote: >> Try >> >> obj.save insert:true > > See original message, in this case specifying insert: true does not > seem to help. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
