-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: SchemaExport fails on many to one
PostPosted: Sun Jan 25, 2004 5:10 am 
Newbie

Joined: Fri Jan 09, 2004 1:02 pm
Posts: 6
I'm trying to have SchemaExport generate my table structure in MySQL. It works as long as there are only one to one mappings but many to one or many to many will yield the following:

Code:
2004-01-25 09:57:48,390 INFO [net.sf.hibernate.cfg.Environment] - <Hibernate 2.1.1>
2004-01-25 09:57:48,406 INFO [net.sf.hibernate.cfg.Environment] - <loaded properties from resource hibernate.properties: {hibernate.connection.driver_class=com.mysql.jdbc.Driver, hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.hibernate.cache.HashtableCacheProvider, hibernate.jndi.class=com.sun.jndi.fscontext.RefFSContextFactory, hibernate.max_fetch_depth=1, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.jndi.url=file:/, hibernate.jdbc.use_streams_for_binary=true, hibernate.jdbc.batch_size=0, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.proxool.pool_alias=pool1, hibernate.connection.pool_size=1}>
2004-01-25 09:57:48,406 INFO [net.sf.hibernate.cfg.Environment] - <using java.io streams to persist binary types>
2004-01-25 09:57:48,421 INFO [net.sf.hibernate.cfg.Environment] - <using CGLIB reflection optimizer>
2004-01-25 09:57:48,437 INFO [net.sf.hibernate.cfg.Configuration] - <configuring from resource: /hibernate.cfg.xml>
2004-01-25 09:57:48,437 INFO [net.sf.hibernate.cfg.Configuration] - <Configuration resource: /hibernate.cfg.xml>
2004-01-25 09:57:49,078 INFO [net.sf.hibernate.cfg.Configuration] - <Mapping resource: com/triligon/addressbook/Person.hbm.xml>
2004-01-25 09:57:49,281 INFO [net.sf.hibernate.cfg.Binder] - <Mapping class: com.triligon.addressbook.Person -> Person>
2004-01-25 09:57:49,390 INFO [net.sf.hibernate.cfg.Binder] - <Mapping collection: com.triligon.addressbook.Person.categories -> HIB_CATEGORIES$TARGET_KEY_ATT_PEOPLE$SOURCE_KEY_ATT>
2004-01-25 09:57:49,468 INFO [net.sf.hibernate.cfg.Binder] - <Mapping subclass: com.triligon.addressbook.PersonImpl -> Person>
2004-01-25 09:57:49,468 INFO [net.sf.hibernate.cfg.Configuration] - <Mapping resource: com/triligon/addressbook/Address.hbm.xml>
2004-01-25 09:57:49,515 INFO [net.sf.hibernate.cfg.Binder] - <Mapping class: com.triligon.addressbook.Address -> Address>
2004-01-25 09:57:49,515 INFO [net.sf.hibernate.cfg.Binder] - <Mapping subclass: com.triligon.addressbook.AddressImpl -> Address>
2004-01-25 09:57:49,515 INFO [net.sf.hibernate.cfg.Configuration] - <Mapping resource: com/triligon/category/GlobalCategory.hbm.xml>
2004-01-25 09:57:49,578 INFO [net.sf.hibernate.cfg.Binder] - <Mapping class: com.triligon.category.GlobalCategory -> GlobalCategory>
2004-01-25 09:57:49,578 INFO [net.sf.hibernate.cfg.Binder] - <Mapping collection: com.triligon.category.GlobalCategory.people -> HIB_CATEGORIES$SOURCE_KEY_ATT_PEOPLE$TARGET_KEY_ATT>
2004-01-25 09:57:49,578 INFO [net.sf.hibernate.cfg.Binder] - <Mapping subclass: com.triligon.category.GlobalCategoryImpl -> GlobalCategory>
2004-01-25 09:57:49,578 INFO [net.sf.hibernate.cfg.Configuration] - <Configured SessionFactory: null>
2004-01-25 09:57:49,609 INFO [net.sf.hibernate.dialect.Dialect] - <Using dialect: net.sf.hibernate.dialect.MySQLDialect>
2004-01-25 09:57:49,609 INFO [net.sf.hibernate.cfg.Configuration] - <processing one-to-many association mappings>
2004-01-25 09:57:49,625 INFO [net.sf.hibernate.cfg.Configuration] - <processing one-to-one association property references>
2004-01-25 09:57:49,625 INFO [net.sf.hibernate.cfg.Configuration] - <processing foreign key constraints>
2004-01-25 09:57:49,703 INFO [net.sf.hibernate.cfg.Configuration] - <processing one-to-many association mappings>
2004-01-25 09:57:49,703 INFO [net.sf.hibernate.cfg.Configuration] - <processing one-to-one association property references>
2004-01-25 09:57:49,703 INFO [net.sf.hibernate.cfg.Configuration] - <processing foreign key constraints>
2004-01-25 09:57:49,718 INFO [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <Running hbm2ddl schema export>
2004-01-25 09:57:49,718 INFO [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <exporting generated schema to database>
2004-01-25 09:57:49,718 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider] - <Using Hibernate built-in connection pool (not for production use!)>
2004-01-25 09:57:49,718 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider] - <Hibernate connection pool size: 1>
2004-01-25 09:57:49,734 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider] - <using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://10.2.2.2/test>
2004-01-25 09:57:49,734 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider] - <connection properties: {user=root, password=terror}>
2004-01-25 09:57:50,203 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <Unsuccessful: create table HIB_CATEGORIES$TARGET_KEY_ATT_PEOPLE$SOURCE_KEY_ATT (PEOPLE$SOURCE_KEY_ATT VARCHAR(255) not null, CATEGORIES$TARGET_KEY_ATT VARCHAR(255) not null, primary key (PEOPLE$SOURCE_KEY_ATT, CATEGORIES$TARGET_KEY_ATT))>
2004-01-25 09:57:50,203 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <Invalid argument value,  message from server: "Specified key was too long. Max key length is 500">
2004-01-25 09:57:50,312 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <Unsuccessful: create table HIB_CATEGORIES$SOURCE_KEY_ATT_PEOPLE$TARGET_KEY_ATT (CATEGORIES$SOURCE_KEY_ATT VARCHAR(255) not null, PEOPLE$TARGET_KEY_ATT VARCHAR(255) not null, primary key (CATEGORIES$SOURCE_KEY_ATT, PEOPLE$TARGET_KEY_ATT))>
2004-01-25 09:57:50,312 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <Invalid argument value,  message from server: "Specified key was too long. Max key length is 500">
2004-01-25 09:57:50,421 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <Unsuccessful: alter table HIB_CATEGORIES$TARGET_KEY_ATT_PEOPLE$SOURCE_KEY_ATT add index (PEOPLE$SOURCE_KEY_ATT), add constraint FK709890502642CB12 foreign key (PEOPLE$SOURCE_KEY_ATT) references Person (personID)>
2004-01-25 09:57:50,421 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <General error,  message from server: "Table 'test.HIB_CATEGORIES$TARGET_KEY_ATT_PEOPLE$SOURCE_KEY_ATT' doesn't exist">
2004-01-25 09:57:50,421 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <Unsuccessful: alter table HIB_CATEGORIES$TARGET_KEY_ATT_PEOPLE$SOURCE_KEY_ATT add index (CATEGORIES$TARGET_KEY_ATT), add constraint FK70989050D46C75B foreign key (CATEGORIES$TARGET_KEY_ATT) references GlobalCategory (globalCategoryID)>
2004-01-25 09:57:50,421 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <General error,  message from server: "Table 'test.HIB_CATEGORIES$TARGET_KEY_ATT_PEOPLE$SOURCE_KEY_ATT' doesn't exist">
2004-01-25 09:57:50,421 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <Unsuccessful: alter table HIB_CATEGORIES$SOURCE_KEY_ATT_PEOPLE$TARGET_KEY_ATT add index (CATEGORIES$SOURCE_KEY_ATT), add constraint FK64342CD01AE693E5 foreign key (CATEGORIES$SOURCE_KEY_ATT) references GlobalCategory (globalCategoryID)>
2004-01-25 09:57:50,421 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <General error,  message from server: "Table 'test.HIB_CATEGORIES$SOURCE_KEY_ATT_PEOPLE$TARGET_KEY_ATT' doesn't exist">
2004-01-25 09:57:50,421 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <Unsuccessful: alter table HIB_CATEGORIES$SOURCE_KEY_ATT_PEOPLE$TARGET_KEY_ATT add index (PEOPLE$TARGET_KEY_ATT), add constraint FK64342CD018A2FE88 foreign key (PEOPLE$TARGET_KEY_ATT) references Person (personID)>
2004-01-25 09:57:50,421 ERROR [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <General error,  message from server: "Table 'test.HIB_CATEGORIES$SOURCE_KEY_ATT_PEOPLE$TARGET_KEY_ATT' doesn't exist">
2004-01-25 09:57:50,421 INFO [net.sf.hibernate.tool.hbm2ddl.SchemaExport] - <schema export complete>
2004-01-25 09:57:50,421 INFO [net.sf.hibernate.connection.DriverManagerConnectionProvider] - <cleaning up connection pool: jdbc:mysql://10.2.2.2/test>


Is this a bug or am I doing something wrong? The mapping files are generated from Java classes generated with AndroMDA which are then processed by xdoclet.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jan 25, 2004 6:39 pm 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
Something is not working in your generation.
Things like:

2004-01-25 09:57:49,390 INFO [net.sf.hibernate.cfg.Binder] - <Mapping collection: com.triligon.addressbook.Person.categories -> HIB_CATEGORIES$TARGET_KEY_ATT_PEOPLE$SOURCE_KEY_ATT>

in your Hibernate startup are off.

Look at Java source being generated by AndroMDA. There looks to be a AndroMDA template problem.


Sherman


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.