Could someone clarify the following aspects in terms of table generation in Glassfish and MySQL:
( i ) What does the IDENTITY table generation type do? ( ii ) Does MySQL support the SEQUENCE generator strategy that is declared in @javax.persistence.SequenceGenerator? This is a more efficient build-in structure to generate IDs sequentially. ( iii ) Lastly, does Glassfish support auto schema generation which eliminate the needs to declare @JoinColumn or PrimaryKeyJoinColumn?
The IDENTITY option simply allows the database to generate a unique primary key for your application. No sequence or table is used to maintain the primary key information, but instead, the database will just pick an appropriate, unique number for Hibernate to assign to the primary key of the entity. With MySQL, the first lowest numbered primary key available in the table in question is chosen, although this behavior may differ from database to database.
I've used @Identity and the @TableGenerator annotations withy MySQL quite successfully. Their use is documented at the end of this tutorial: