-->
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: once-more:issue with one-to-many mapping
PostPosted: Mon Jul 05, 2004 3:23 am 
Newbie

Joined: Fri Jul 02, 2004 6:47 am
Posts: 12
Hi,
My DB structure is

ParentTable
id - PK
----

ChildTable (having composite PK)
id pk (same as parent)
lcle-cd pk
---

My mapping
Mapping - PARENT CLASS
<class name="Parent" table="ParentTable" lazy="false" mutable="false">
<id name="id" type="string">
<column name="ID" />
<generator class="assigned"/>
</id>
<bag name="lblList" lazy="false" inverse="true" >
<key column="ID"/>
<one-to-many class="CsdI18NObj"/>
</bag>

</class>

Mapping - CHILD CLASS


<class name="CsdI18NObj" table="CHILD">
<composite-id>
<key-many-to-one name="Id" column="ID"/>
<key-many-to-one name="lclCode" column="LCLE_CD"/> </composite-id>


<property name="lbl" column="LBL_TX" type="string"/>
</class>

My Java code

l = hibSession.createQuery("select p.id, p from Parent p left join fetch p.lblList ").list();


My Problem

This is not working and is giving an error

processing one-to-one association property references
[7/5/04 12:50:06:100 IST] f9fbd9 Configuration I net.sf.hibernate.cfg.Configuration processing foreign key constraints
[7/5/04 12:50:06:741 IST] f9fbd9 WebGroup E SRVE0026E: [Servlet Error]-[]: java.lang.ExceptionInInitializerError

Any help is appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 05, 2004 4:44 am 
Newbie

Joined: Fri Jul 02, 2004 6:47 am
Posts: 12
sorry I want to change my query.

Actually I want the reference of child in parent and child does not know about the parent (no parent reference in child) .
So I changed the mapping file to
Mapping - CHILD CLASS


<class name="CsdI18NObj" table="CHILD">
<composite-id>
<key-property name="Id" column="ID"/>
<key-property name="lclCode" column="LCLE_CD"/> </composite-id>


<property name="lbl" column="LBL_TX" type="string"/>
</class>

Other things remain the same as in the prev query

I am using Hibernate version 2.1.4.
Database is DB2

It is giving an SQL error.
Pls Help.


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.