-->
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.  [ 6 posts ] 
Author Message
 Post subject: SchemaExport and custom UserTypes
PostPosted: Tue Jun 22, 2004 10:36 am 
Regular
Regular

Joined: Mon Oct 06, 2003 1:59 am
Posts: 52
Dear Folks,

I have currently problems setting up the classpath of SchemaExporter. It does not likes my custom EnumType class. The class is in classpath of eclipse and in classpath of maven.

First of all it tried the wonderful maven-hibernate plugin which works great most of the cases, but fails to load the EnunType class.

The I fall back and tried to use the SchemaExporter manually. I have the same result:

Code:
   Configuration configuration = new Configuration();
      
      Properties properties = new Properties();
      properties.load(  SchemaExporter.class.getResourceAsStream("/hibernate.properties"));
   
      
      configuration.setProperties(properties);   
      configuration.addClass(Accountablity.class);
      configuration.addClass(SentinelUser.class);
      configuration.addClass(Area.class);
      configuration.addClass(Contact.class);
      configuration.addClass(Customer.class);
      configuration.addClass(CustomerGroup.class);
      configuration.addClass(DoctorsOffice.class);
      configuration.addClass(Drugstore.class);
      configuration.addClass(Hospital.class);
      configuration.addClass(Pharmaceutics.class);
      configuration.addClass(Region.class);
      

      new SchemaExport(configuration).create(true, false);


and here is the exception:

Code:
16:34:01,102  INFO Environment:432 - Hibernate 2.1.1
16:34:01,182  INFO Environment:466 - loaded properties from resource hibernate.properties: {hibernate.query.substitutions=yes 'Y', no 'N', hibernate.cache.region_prefix=turbine.sentinel, hibernate.show_sql=true, hibernate.proxool.pool_alias=pool1, hibernate.jdbc.batch_size=0, hibernate.jdbc.fetch_size=25, hibernate.cache.use_query_cache=true, hibernate.jdbc.use_streams_for_binary=true, hibernate.max_fetch_depth=1, hibernate.use_outer_join=true, hibernate.connection.pool_size=1, hibernate.connection.username=tobias.rademacher, hibernate.connection.driver_class=org.postgresql.Driver, hibernate.cache.provider_class=net.sf.hibernate.cache.OSCacheProvider, hibernate.cglib.use_reflection_optimizer=true, hibernate.transaction.factory_class=net.sf.hibernate.transaction.JDBCTransactionFactory, hibernate.dialect=net.sf.hibernate.dialect.PostgreSQLDialect, hibernate.connection.url=jdbc:postgresql://localhost/apogee_domain_model/}
16:34:01,192  INFO Environment:480 - using java.io streams to persist binary types
16:34:01,202  INFO Environment:481 - using CGLIB reflection optimizer
16:34:01,232  INFO Configuration:318 - Mapping resource: innowake/apogee/domain/model/accountability/Accountablity.hbm.xml
16:34:01,763  INFO Binder:225 - Mapping class: innowake.apogee.domain.model.accountability.Accountablity -> ACCOUNTABLITY
16:34:02,063  INFO Binder:534 - Mapping collection: innowake.apogee.domain.model.accountability.Accountablity.subordinates -> subordinates

16:34:02,183  INFO Binder:200 - Mapping joined-subclass: innowake.apogee.domain.model.master.CustomerGroup -> CUSTOMER_GROUP
16:34:02,203  INFO Configuration:318 - Mapping resource: innowake/turbine/sentinel/model/SentinelUser.hbm.xml
16:34:02,313  INFO Binder:225 - Mapping class: innowake.turbine.sentinel.model.SentinelUser -> TURBINE_USER
16:34:02,353  INFO Binder:200 - Mapping joined-subclass: innowake.apogee.domain.model.accountability.Person -> PERSON
16:34:02,353  INFO Configuration:318 - Mapping resource: innowake/apogee/domain/model/master/Area.hbm.xml
16:34:02,514  INFO Binder:225 - Mapping class: innowake.apogee.domain.model.master.Area -> AREA
16:34:02,514  INFO Binder:534 - Mapping collection: innowake.apogee.domain.model.master.Area.pharamIdentifiers -> AREA_PHARMACEUTICS_ASSIGNMENT
16:34:02,524  INFO Configuration:318 - Mapping resource: innowake/apogee/domain/model/master/Contact.hbm.xml
16:34:02,594  INFO Binder:225 - Mapping class: innowake.apogee.domain.model.master.Contact -> CONTACT
16:34:02,684 ERROR Configuration:250 - Could not compile the mapping document
net.sf.hibernate.MappingException: Cannot instantiate custom type: innowake.hibernate.customizing.EnumType
   at net.sf.hibernate.type.CustomType.<init>(CustomType.java:38)
   at net.sf.hibernate.type.TypeFactory.heuristicType(TypeFactory.java:163)
   at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:894)
   at net.sf.hibernate.cfg.Binder.bindSimpleValue(Binder.java:403)
   at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1008)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:344)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1204)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:247)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:281)
   at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:322)
   at innowake.hibernate.SchemaExporter.main(SchemaExporter.java:50)
net.sf.hibernate.MappingException: Error reading resource: innowake/apogee/domain/model/master/Contact.hbm.xml
   at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:325)
   at innowake.hibernate.SchemaExporter.main(SchemaExporter.java:50)
Caused by: net.sf.hibernate.MappingException: Cannot instantiate custom type: innowake.hibernate.customizing.EnumType
   at net.sf.hibernate.type.CustomType.<init>(CustomType.java:38)
   at net.sf.hibernate.type.TypeFactory.heuristicType(TypeFactory.java:163)
   at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:894)
   at net.sf.hibernate.cfg.Binder.bindSimpleValue(Binder.java:403)
   at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1008)
   at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:344)
   at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1204)
   at net.sf.hibernate.cfg.Configuration.add(Configuration.java:247)
   at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:281)
   at net.sf.hibernate.cfg.Configuration.addClass(Configuration.java:322)
   ... 1 more
Exception in thread "main"


How do I deal with custom types and SchemaExport?

Any help is highly appricated ;)

Lot's of thx.

Toby

_________________
"Wisest of the Maia was Ol


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 10:44 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Try without eclipse or maven.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 11:13 am 
Regular
Regular

Joined: Mon Oct 06, 2003 1:59 am
Posts: 52
christian wrote:
Try without eclipse or maven.


Thx for your quick response. I will build a small test screnario without using both eclipse or maven and post the results to this thread. Keep your fingers crossed ;), but it would be nice to get it run into the continuous environment Maven offers. Sounds like one of the tricky, evil classloader woes I have so much, doesn't it?

Does upgrading to maven 2.1.4 may help?!?

_________________
"Wisest of the Maia was Ol


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 11:13 am 
Regular
Regular

Joined: Mon Oct 06, 2003 1:59 am
Posts: 52
tradem wrote:
Does upgrading to maven 2.1.4 may help?!?


I mean hibernate 2.1.4 ;) Sorry.

_________________
"Wisest of the Maia was Ol


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 11:14 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Maven is Maven, avoid it.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 22, 2004 11:29 am 
Regular
Regular

Joined: Mon Oct 06, 2003 1:59 am
Posts: 52
christian wrote:
Maven is Maven, avoid it.


... I don't want to start yet another time wasting reglious debate ;)

If you provide another build system with same power which avoid to set up its own ClassLoader hierarchy - please tell where to get it. Ant has it's one problems. It is not a competitive solution to build up complex J2EE application if you have to to release mangement casually.

IMHO it would be the best to redesing the odd ClassLoader hierachry which never seems to be desinged for the stuff we all do today... :-P

_________________
"Wisest of the Maia was Ol


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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.