How did you created the foreign key?
I haven't tried seam-gen and MySql myself, but If you created the foreign key it as explained here
and you are using the latest MySQL, and the latest JDBC driver it should work...
If it still doesn't work, maybe you need to set the hibernatetool.metadatadialect to MySqlMetaDataDialect in the hibernate.console configuration.
thanks for your help.
The only difference I see is that I use Varchar(45) instead of integer.
It seems that manyToOne relationship cannot be created neither in the entities nor in the forms :o(
I realize this it's been a while on this thread, but I've spent days banging my head on this, and I've been doing this type of work for a long time. I hope this helps others avoid such project delays.
The answer is that MySQL 5 (didn't try prev versions) does not receive multiplicity annotations such as ToOne and ToMany using either seam-gen or hibernate/jboss tools. I generated my data model from Toad and created DDL for both MySQL 5 and PostgreSQL 8.0. The annotations for multiplicity are generated for PostgreSQL, but not for MySQL. I'm not sure where this problem lies - the exporter, the dialect, etc. and don't have time now to check it out. Luckily for me this project gives me the freedom to choose the db platform and to also control the schema. I don't envy those stuck with MySQL and hitting this issue.
I'll note here that this is definitely not the first time I've had to give up on MySQL and switch to PostgreSQL to get an app to work, both my own and third party.
Of course you can go with the backup plan - generate your entities from MySQL and just add the multiplicity annotations themselves by hand - you still get 90% of your work done by the generator. Then generate the UI on it's own. You can make your incremental manual changes to the DB schema via updating the entity classes. Then just set hibernate.hbm2ddl.auto to 'update' in your persistence.xml or hibernate config to sync the entities and the db schema.