-
1. Re: The database returned no natively generated identity val
wolfgangknauf Feb 13, 2009 4:42 AM (in response to mravikrish)Shouldn't the "@GeneratedValue" annotation declare a sequence strategy (instead of "Auto")?
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "projectid_sequence")
Which database do you use?
Wolfgang -
2. Re: The database returned no natively generated identity val
mravikrish Feb 13, 2009 7:09 AM (in response to mravikrish)i am using mysql
-
3. Re: The database returned no natively generated identity val
wolfgangknauf Feb 13, 2009 8:27 AM (in response to mravikrish)Hmmm, after doing a bit of google I found that MySQL 5 does not support sequences at all. There are Auto Increment columns possible, but no sequence which updates it's value on each "select nextval from sequencename".
Leave the strategy to "AUTO", remove the "@SequenceGenerator" annotation and hope that Hibernate uses an appropriate default.
And activate SQL statement logging in your persistence.xml and take a look at the statements which are fired against your MySQL. Maybe they provide more info.
Hops this helps
Wolfgang -
4. Re: The database returned no natively generated identity val
mravikrish Feb 14, 2009 12:28 AM (in response to mravikrish)Thanks WolfGang , i found the problem why sequence is not working. here ejb is creating tables
if i remove tables and run my application it is working fine. but now my requirement is to prevent ejb creating tables. Is there any set up to do like that.
Ramu -
5. Re: The database returned no natively generated identity val
wolfgangknauf Feb 16, 2009 8:09 AM (in response to mravikrish)Hi Ramu,
I'm sorry but I fear I don't understand your question.
Do you mean that JBoss should not create tables on deploy? If yes: what is the property "hibernate.hbm2ddl.auto" in your "persistence.xml" set to?
The following snippet creates tables on deploy and drops them on undeploy:<property name="hibernate.hbm2ddl.auto" value="create-drop" />
Best regards
Wolfgang