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: HELP Please !
PostPosted: Wed Jan 19, 2005 11:23 pm 
Newbie

Joined: Mon Jan 17, 2005 9:05 am
Posts: 17
I have 3 tables

A (

ID NUMBER(19)
FIELD VARCHAR2(255)
primary key (ID)

)

B (

ID NUMBER(19),
NAME VARCHAR2(255)
primary key (ID)
)

C (
ID NUMBER(19)
VERSION NUMBER(10)
primary key (ID, VERSION)
)

A's primary key is genereated by my own id generator, and B's primary key is the same with A's. SO B in fact is reference to A to get its primary key. and C is a composite key(ID, VERSION), "ID" will reference to table B's key "ID".

I have class for A, B, C, and C's composite primary key class CKey

Mapping file
A.hbm.xml

<id name="id" type="long" unsaved-value="null">
<generator class="MyIDGenerator" />
</id>

<one-to-one name="b" class="B" />


B.hbm.xml

<id name="id" type="long">
<generator class="foreign" >
<param name="property">variableInstance</param>
</generator>
</id>
<one-to-one name="a" class="A" constrained="true"/>

<set name="test1Set" >
<key column="ID" />
<one-to-many class="C" />
</set>


C.hbm.xml
<composite-id name="ckey" class="CKey" >
<key-property name="version" type="integer" column="VERSION"/>
<key-many-to-one name="id" class="B" column="ID" />
</composite-id>
<many-to-one name="b" class="B" update="false" insert="false" access="property" not-null="true" column="ID" />


I am sure that A and B's mapping is correct, because the data did insert into table A and B, but for the mapping of B and C I am not sure, because I got the error of "no persistent for" error.

Code before session open and session close
Code:
A a = new A();
     //and set id to A by some other codes.
     B b = new B();
     b.setA(a);
   
      persistenceSession.save(B);
      //initiate C and PK class
      C c = new C();
      CKey key = new Ckey();
      test2.setB(b);
      key.setId(b.getId());
      key.setVersion(new Integer(1));

I got the error :

(
Code:
net.sf.hibernate.MappingException) No persister for: java.lang.Long
   at org.jbpm.persistence.hibernate.HibernateSession.commitTransaction(HibernateSession.java:66)
   at org.jbpm.impl.ExecutionServiceImpl.startProcessInstance(ExecutionServiceImpl.java:132)
   at org.jbpm.web.struts.action.TaskFormSubmitAction.execute(TaskFormSubmitAction.java:49)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482


DO I did something wrong here? I initiate my composite key manually here. But still got the error. Could anyone help me?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 21, 2005 5:54 am 
Newbie

Joined: Mon Aug 09, 2004 7:29 am
Posts: 10
Location: India
Quote:
C.hbm.xml
<composite-id name="ckey" class="CKey" >
<key-property name="version" type="integer" column="VERSION"/>
<key-many-to-one name="id" class="B" column="ID" />
</composite-id>
<many-to-one name="b" class="B" update="false" insert="false" access="property" not-null="true" column="ID" />


Can you try specifying the type for the id column.


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.