-->
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.  [ 3 posts ] 
Author Message
 Post subject: Custom Persister with a Joined Subclass
PostPosted: Wed Jul 21, 2004 5:44 pm 
Newbie

Joined: Thu Apr 15, 2004 10:17 am
Posts: 14
Location: Manhattan
Hi,

How do I go about specifying a custom persister for class that has a joined subclass? Below is my mapping. I would like the class UserId and the joined subclass UserLogin to use the same custom entity persister I've written. Anyone know how to do this without getting the discriminator not being set warning? (Incidentally, I tried adding a discriminator to the UserId class and that didn't work)

Code:
   <class name="UserId" table="[USER]" persister="com.bolt.service.hibernate.persister.MyEntityPersister">
      <id name="id" type="java.lang.Integer" column="ID" unsaved-value="null">
         <generator class="native"/>
      </id>

      <property name="memberName" type="java.lang.String" column="MEMBERNAME"/>
      <property name="password" type="java.lang.String" column="PASSWORD"/>
      <property name="passwordEncrypted" type="java.lang.Boolean" column="ISPASSWORDENCRYPTED"/>

      <!-- ========== -->
      <!-- USER LOGIN -->
      <!-- ========== -->
      <joined-subclass name="UserLogin" table="USERLOGINHISTORY" persister="com.bolt.service.hibernate.persister.MyEntityPersister">
         <key column="USERID"/>
         <property name="lastLogin" type="java.util.Date" column="LASTLOGIN"/>
         <property name="totalLogins" type="int" column="TOTALLOGINS"/>
      </joined-subclass>
   </class>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 10:05 am 
Newbie

Joined: Thu Apr 15, 2004 10:17 am
Posts: 14
Location: Manhattan
By the way, here's the error I get if I try to use the above mapping....thanks.

Code:
net.sf.hibernate.MappingException: discriminator mapping required for polymorphic persistence
        at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:752)
        at com.bolt.service.hibernate.persister.BoltEntityPersister.<init>(BoltEntityPersister.java:19)
        at sun.reflect.GeneratedConstructorAccessor32.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at net.sf.hibernate.persister.PersisterFactory.create(PersisterFactory.java:75)
        at net.sf.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:47)
        at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:137)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 22, 2004 4:18 pm 
Newbie

Joined: Thu Apr 15, 2004 10:17 am
Posts: 14
Location: Manhattan
It's a bug/feature that hasn't been added yet...

http://opensource.atlassian.com/project ... wse/HB-174


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