-->
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.  [ 1 post ] 
Author Message
 Post subject: Having Problems with a one to many set
PostPosted: Tue May 08, 2007 9:53 pm 
Newbie

Joined: Tue May 08, 2007 7:28 pm
Posts: 1
Location: Texas
I am using Hibernate3 running on JBoss accessing SQLServer 2005.

1. I have the following setup in log4j.xml
<category name="org.hibernate.type">
<priority value="INFO"/>
</category>
but it is still not telling me the value of the ? in my SQL.


2. I am having problems setting up a set mapping.
Table1 - Division:
divisionId integer identity not null, (key) oldDivisionCode String not null

Table2 - Community:
communityId integer identity not null, (key) oldCommunityCode String not null, oldDivisionCode String not null



Division.hbm.xml:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.ve.data.hibernate.mappings.Division" table="Division" schema="dbo" catalog="VendorExtranet">
<id name="id" type="java.lang.Integer" column="divisionId" >
<generator class="identity" />
</id>
<property name="divisionCode" type="java.lang.String">
<column name="oldDivisionCode" length="10" not-null="true" />
</property>
<set name="communities" inverse="true">
<key column="oldDivisionCode" not-null="true" />
<one-to-many class="com.ve.data.hibernate.mappings.Community" />
</set>
</class>
</hibernate-mapping>


Community.hbm.xml:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
<class name="com.ve.data.hibernate.mappings.Community" table="Community" schema="dbo" catalog="VendorExtranet">
<id name="id" type="java.lang.Integer">
<column name="communityId" />
<generator class="identity" />
</id>
<property name="projectCode" type="java.lang.String">
<column name="oldProjectCode" length="12" not-null="true" />
</property>
<property name="divisionCode" type="java.lang.String">
<column name="oldDivisionCode" length="3" />
</property>
<many-to-one name="division" class="com.ve.data.hibernate.mappings.Division" unique="true" insert="false" update="false">
<column name="oldDivisionCode" not-null="true" />
</many-to-one>
</class>
</hibernate-mapping>


The communities set is not working properly it needs to join Division and Community on oldDivisionCode,
but I think it seems to be joining oldDivisionCode to (divisionId or communityId).
I can't quite tell because I can't see the result of the ? in the query.

Below is the query result that I am getting when I call
Division division;
//division found by Id
division.getCommunities();

20:48:04,587 INFO [STDOUT] Hibernate: select communitie0_.jdeDivisionCode as jdeDivis3_1_, communitie0_.communityId as communit1_1_, communitie0_.communityId as communit1_0_0_, communitie0_.jdeProjectCode as jdeProje2_0_0_, communitie0_.jdeDivisionCode as jdeDivis3_0_0_
from VendorExtranet.dbo.Community communitie0_
where communitie0_.jdeDivisionCode=?


Any help would be greatly appreciated.
Thanks,
pcable


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.