hmm - sounds like a bug in mysql reverse engineering....
Might be related to https://issues.jboss.org/browse/JBIDE-7488 fix
Workaround set hibernate.default_catalog="sample2" and you should not get any mentions of catalog in your reverse engineering.
could you please check the validation with @Table(name = "F", schema= "sample2", catalog= "sample2")
I guess hibernate tool doesn't add schema as consider it as default.
(In url you have something jdbc:mysql://localhost:3306/?nullCatalogMeansCurrent=false)
where mymysql is schema and you don't need to override it.
Does hibernate work with generated annotation:
@Table(name = "F", catalog= "sample2")
or with updated
@Table(name = "F", schema= "sample2")?
Please check also
@Table(name = "F", schema= "sample2", catalog= "sample2")
I ask this because it could be a problem of the validator, but not hibernate tools.
we checked this ourself. The hibernate works well with @Table(name = "F", catalog= "sample2") and one of the folowwing:
3) jdbc:mysql://localhost:3306/ hibernate.default_catalog=sample2
@Table(name = "F", schema= "sample2") works in the cases:
3) jdbc:mysql://localhost:3306/ hibernate.default_schema=sample2
The jpa validator is not consistent in some cases
Any news about this topic??
I have the same problem with stable release of jboss developer studio (6.0).
In my case the error is only for the validator because i can use the genereted class without problem.
i'm also able to fix the error but i need remove manually the catalog definition and have an annotation like this
@Table(name = "F")
and default values (in JPA property windows) are "Default" for catalog and "Default (sample2)" for schema
Also with this fix my project work.
In jboss dev studio i have a Database Connection like jdbc:mysql://localhost:3306/sample2
while on AS and in persistence.xml use data source with jta (connection string is always like jdbc:mysql://localhost:3306/sample2)
Is there a way to not generate the catalog attribute in annotation ??
This behavior has been standard for MySQL and hibernate from the beginning. I belive the MySQL driver interprets a database schema the same as an Oracle catalog .... but a MySQL catalog has subtle differences from a schema and does not play well with hibernate.
My standard fix up (workaround) is to immediately remove the catalog property. I most frequently use Forge to reverse engineer and generate a CRUD webapp ..... so it's become routine for me. Thanks to Eric for reporting the issue .... I should have done so long ago.
set hibernate.default_catalog and hibernate.default_schema and the reverse engineering will obey that and remove it.
If someone know of a way to reliably know from a jdbc connection which schema/catalog is the default then we could avoid this, but I haven't found a way that is sane.
Thanks for yours suggestions!
@Gerry many thanks...Forge its a great project.
@Max i try to set these properties in persistence.xml and in the optional parameters of the database connection..but with no luck, i have always the catalog annotation
hmm - it should just work.
Can you show me the generated code and the persistence.xml you are using ?