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.
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.
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:
Reason: javax.persistence.PersistenceException: org.hibernate.HibernateException: Missing sequence or table: hibernate_sequence
I Depend On:
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"
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.