[Lift] Re: JPA and auto generation of id

2009-06-25 Thread Derek Chen-Becker
I've used JPA with MySQL in the past and I don't recall having to specify a generator to get auto-incremenet IDs working. Does the schema for this particular entity have AUTO_INCREMENT set for the id column? Derek On Wed, Jun 24, 2009 at 5:29 PM, David Persons dhwpers...@gmail.com wrote:

[Lift] Re: JPA and auto generation of id

2009-06-24 Thread David Persons
Thanks for all the answers guys. I managed to fix the id problem, I needed the Hibernate specific class GenericGenerator to fix it, which of cource is less pretty then using only JPA. Someone has an example of how to make it work with MySql and only JPA annotations? Current version: @Entity

[Lift] Re: JPA and auto generation of id

2009-06-24 Thread Bryan
Try upgrading your hibernate version from 3.3.1.ga to 3.3.2.GA. Derek, can you look into upgrading the archetype to this release as well? I recall 3.3.1.ga having some packaging issues. --Bryan On Wed, Jun 24, 2009 at 6:29 PM, David Personsdhwpers...@gmail.com wrote: Thanks for all the

[Lift] Re: JPA and auto generation of id

2009-06-24 Thread Meredith Gregory
David, The GenericGenerator annotation was the solution i found worked for me for Hibernate 3.3.2GA, and the one i suggested you investigate. i'm glad you've gotten past that one. Best wishes, --greg On Wed, Jun 24, 2009 at 3:29 PM, David Persons dhwpers...@gmail.com wrote: Thanks for all

[Lift] Re: JPA and auto generation of id

2009-06-22 Thread Oliver Lambert
What sort of database are you trying to use Hibernate against (look at the property hibernate.dialect in the file persistence.xml)? I think the error may mean that your trying to use GenerationType.AUTO against a database that doesn't support it. On Mon, Jun 22, 2009 at 7:08 PM, David Persons

[Lift] Re: JPA and auto generation of id

2009-06-22 Thread Mojo
My guess: It depends on the DB you're using. If it's Oracle, you may need to create a sequence for the table ID. Alternatively your ORM configuration may need to know what dialect of database to use. Mojo -- Morris Jones Monrovia, CA m...@whiteoaks.com http://mojo.whiteoaks.com On Sun, Jun

[Lift] Re: JPA and auto generation of id

2009-06-22 Thread Eric Bowman
David Persons wrote: Hello guys, I get a org.hibernate.exception.SQLGrammarException: could not get or update next value error everytime I try to save the following Entity: @Entity class Scene { @Id @GeneratedValue(){val strategy = GenerationType.AUTO} var id : Long = _

[Lift] Re: JPA and auto generation of id

2009-06-22 Thread Derek Chen-Becker
That's not accurate, at least with Hibernate. By putting the annotations on vars, the compiler ends up putting them on the internal fields, which then forces Hibernate into a field-based persistence model and not a getter/setter based one. The SQLGrammarException is most likely what the other

[Lift] Re: JPA and auto generation of id

2009-06-22 Thread Meredith Gregory
David, i recently ran into an issue that smells exactly like this. For hibernate i had to do the following: @Id @GeneratedValue(){generator = system-uuid} @GenericGenerator(){name = system-uuid, strategy = uuid} This is hibernate specific. This was for an Id property that was typed String.

[Lift] Re: JPA and auto generation of id

2009-06-22 Thread David Persons
I am using MySql (5). After setting the hibernate.dialect to org.hibernate.dialect.MySQLDialect in my persistence.xml file, I get a org.hibernate.AssertionFailure: null id :-s cheers On 22 jun, 19:18, Derek Chen-Becker dchenbec...@gmail.com wrote: That's not accurate, at least with Hibernate.

[Lift] Re: JPA and auto generation of id

2009-06-22 Thread Derek Chen-Becker
Mind posting the snippet of code where you're saving the instance? A merge should interpret a null ID as a fresh instance, and a persist should just save it. Derek On Mon, Jun 22, 2009 at 1:50 PM, David Persons dhwpers...@gmail.com wrote: I am using MySql (5). After setting the

[Lift] Re: JPA and auto generation of id

2009-06-22 Thread Derek Chen-Becker
Also, what does the schema for the entity's table look like? On Mon, Jun 22, 2009 at 4:54 PM, Derek Chen-Becker dchenbec...@gmail.comwrote: Mind posting the snippet of code where you're saving the instance? A merge should interpret a null ID as a fresh instance, and a persist should just save