-->
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: Implementing UserType
PostPosted: Fri Dec 24, 2004 6:10 pm 
Newbie

Joined: Fri Dec 17, 2004 3:08 pm
Posts: 3
Hi,

Our application deals with specific 'type' classes that need to be used instead of int, double etc. For this, I implemented a UserType class that is specifically for use by Hibernate and extends the type classes required by my application so that the hibernate object returned would already be of the type as required by my app.

In code terms...

CUSIP: A String stored in my database
Cusip: A class used to store this cusip value. The entire application expects this class instead of just a plain string.
SBSHibernateCusip: My implementation of UserType that I want the objects to return so that the objects returned by Hibernate can directly be used by my classes.

The classes compile fine but I get the exception stated below when I run my app. Please advise...

Hibernate version:2.1.6

Mapping documents:
*.hbm File
<property
column="CUSIP"
length="9"
name="cusip"
not-null="true"
type="SBSHibernateCusip"
/>

Full stack trace of any exception that occurs:

net.sf.hibernate.MappingException: Could not interpret type: SBSHibernateCusip
at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:934)
at net.sf.hibernate.cfg.Binder.bindSimpleValue(Binder.java:435)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1047)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:288)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
at sbs.framework.hibernate.base._BaseRootDAO.initialize(_BaseRootDAO.java:53)
at sbs.dealerInterface.tradehub.mdb.TradeJMSStartup.testingHibernate(TradeJMSStartup.java:80)
at sbs.dealerInterface.tradehub.mdb.TradeJMSStartup.startup(TradeJMSStartup.java:70)
at weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassService.java:177)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.java:158)
at weblogic.t3.srvr.StartupClassService.access$000(StartupClassService.java:36)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:121)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassService.java:116)
at weblogic.t3.srvr.PostDeploymentStartupService.resume(PostDeploymentStartupService.java:63)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)
<Dec 24, 2004 1:40:58 PM PST> <Critical> <WebLogicServer> <BEA-000286> <Failed to invoke startup class
net.sf.hibernate.MappingException: Error reading resource: TradeOrderMaster.hbm
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:339)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:1013)
at net.sf.hibernate.cfg.Configuration.doConfigure(Configuration.java:969)
at net.sf.hibernate.cfg.Configuration.configure(Configuration.java:897)
at sbs.framework.hibernate.base._BaseRootDAO.initialize(_BaseRootDAO.java:53)
at sbs.dealerInterface.tradehub.mdb.TradeJMSStartup.testingHibernate(TradeJMSStartup.java:80)
at sbs.dealerInterface.tradehub.mdb.TradeJMSStartup.startup(TradeJMSStartup.java:70)
at weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassService.java:177)
at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.java:158)
at weblogic.t3.srvr.StartupClassService.access$000(StartupClassService.java:36)
at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:121)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassService.java:116)
at weblogic.t3.srvr.PostDeploymentStartupService.resume(PostDeploymentStartupService.java:63)
at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
at weblogic.Server.main(Server.java:32)
Caused by: net.sf.hibernate.MappingException: Could not interpret type: SBSHibernateCusip
at net.sf.hibernate.cfg.Binder.getTypeFromXML(Binder.java:934)
at net.sf.hibernate.cfg.Binder.bindSimpleValue(Binder.java:435)
at net.sf.hibernate.cfg.Binder.propertiesFromXML(Binder.java:1047)
at net.sf.hibernate.cfg.Binder.bindRootClass(Binder.java:362)
at net.sf.hibernate.cfg.Binder.bindRoot(Binder.java:1256)
at net.sf.hibernate.cfg.Configuration.add(Configuration.java:252)
at net.sf.hibernate.cfg.Configuration.addInputStream(Configuration.java:288)
at net.sf.hibernate.cfg.Configuration.addResource(Configuration.java:336)
... 18 more

Name and version of the database you are using:
Oracle 9i


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 24, 2004 6:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
you have to give the full classname in your type="xxx" declaration.


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.