-
1. Re: seam-gen and @GeneratedValue
gavin.king Mar 23, 2007 11:04 AM (in response to andyd)Currently the Hibernate Tools core is not able to detect autoincrement columns (there is nothing in the standard JDBC metadata for it), and it will never be possible to detect columns that are assigned from a sequence value.
However, max is going to get the autoincrement detection working for at least MySQL ASAP. -
2. Re: seam-gen and @GeneratedValue
andyd Mar 23, 2007 12:20 PM (in response to andyd)Thanks Gavin and Max.
I'm looking at seeing how I can design the sight around what you generate without tweaking the generated stuff, java and xhtml. That way it should make changes to the datamodel as painless as possible.
Andy. -
3. Re: seam-gen and @GeneratedValue
anarinsky Apr 6, 2007 1:06 PM (in response to andyd)Andy,
I have the same problem with generated entities.
Did you find any workaround?
My database was generated by Hibernate using org.hibernate.tool.hbm2ddl.SchemaExportTask
Id supposed to be auto generated. However, when I add @GeneratedValue to the Id getter I am getting the exception on startup:
ObjectName: persistence.units:ear=spot4.ear,unitName=spot4
State: FAILED
Reason: javax.persistence.PersistenceException: org.hibernate.HibernateException: Missing sequence or table: hibernate_sequence
I Depend On:
jboss.jca:service=DataSourceBinding,name=spot4Datasource
With the old variant of Hibernate this auto sequence generated worked with the following annotation used in Doclet:
/**
* @hibernate.id column="ID" generator-class="increment" unsaved-value="0"
*/
Thank you! -
4. Re: seam-gen and @GeneratedValue
andyd Apr 6, 2007 3:54 PM (in response to andyd)Hiya,
Sorry, project isn't currently critical so I'm holding on until seam-gen can do the work. My fix would be to add the annotation, as you suggest. The other thing is to check the persistent configuration. I think mine ended up with validate in one of the properties in persistence.xml, which I would probably change to update and allow the code then to regenerate the schema for me. It may be that you'll need to check out the @GeneratedValue parameters to make sure that you select the appropriate option for the way that your database works with sequence numbers. The default may not be suitable for your set up.
Andy.