-
1. Re: Automatic table creation
waynebaylor Jul 6, 2007 9:51 AM (in response to georgesberscheid)what's hibernate.hbm2ddl.auto set to?
you could also check jboss/server/default/log/server.txt
which may have more info about the errors. -
2. Re: Automatic table creation
georgesberscheid Jul 6, 2007 10:27 AM (in response to georgesberscheid)Hi,
thanks for you reply.<property name="hibernate.hbm2ddl.auto" value="update" />
All it says in addition to the above is the following:16:12:18,321 INFO [Ejb3Configuration] found EJB3 Entity bean: eu.mpulse.commons.repository.customers.Account 16:12:18,331 INFO [Ejb3Configuration] found EJB3 Entity bean: eu.mpulse.commons.repository.customers.Customer 16:12:18,712 INFO [AnnotationBinder] Binding entity from annotated class: eu.mpulse.commons.repository.customers.Account 16:12:18,712 INFO [EntityBinder] Bind entity eu.mpulse.commons.repository.customers.Account on table accounts 16:12:18,672 INFO [AnnotationBinder] Binding entity from annotated class: eu.mpulse.commons.repository.customers.Customer 16:12:18,672 INFO [EntityBinder] Bind entity eu.mpulse.commons.repository.customers.Customer on table customers 16:12:21,236 ERROR [SchemaUpdate] Unsuccessful: alter table accounts add index FK809DBBE624CB3F8D (customer_id), add constraint FK809DBBE624CB3F8D foreign key (customer_id) references customers (id) 16:12:21,236 ERROR [SchemaUpdate] Duplicate key name 'FK809DBBE624CB3F8D'
but those messages all seem related to the original problem to me.
Thanks,
Georges -
3. Re: Automatic table creation
waynebaylor Jul 6, 2007 11:16 AM (in response to georgesberscheid)Hibernate has this info about the update setting
Creates the database schema on deploy if it doesn't exist. Alters it if it has changed. Useful for when you want to generate database schema from entity beans
The errors you're getting are because the schema and constraints already exist. Are you using Hibernate to generate the schema or did you do it manually? -
4. Re: Automatic table creation
georgesberscheid Jul 6, 2007 11:34 AM (in response to georgesberscheid)Right, that's the theory. The database was empty at first. The tables were created the first time I deployed the beans.
If I change the entity beans, the tables are not modified at redeployment. SQL Exceptions are thrown instead when the data is accessed because the schema doesn't match. But that doesn't matter because I don't change my beans.
I'm just wondering why it says that the tables do not exist if it has just created them in the previous deployment. -
5. Re: Automatic table creation
waynebaylor Jul 6, 2007 12:03 PM (in response to georgesberscheid)yeah, I've only seen those errors when using create-drop and it can't drop the tables because they don't exist. But that's not a fatal error and things still work...
-
6. Re: Automatic table creation
fhh Jul 7, 2007 9:21 AM (in response to georgesberscheid)Can the database user "see" those tables, e.g. get meta data about them?
Regards
Felix -
7. Re: Automatic table creation
georgesberscheid Jul 7, 2007 1:17 PM (in response to georgesberscheid)The MySQL user has 'all privileges' on the database. In the previous deployment that same user was able to create the tables that he can't find in the second deployment of the entity beans.