-->
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: Problem with hbm file
PostPosted: Thu Apr 15, 2004 2:20 pm 
Beginner
Beginner

Joined: Thu Apr 15, 2004 2:01 pm
Posts: 25
Hi

I am getting the following error when I try to save CommodityGroup. There are different hbm files for Commodity, CommodityGroup etc. and error is causing due to the Commodity hbm file.

Error is as follows:

[4/15/04 13:46:39:811 EDT] 7c066763 Configuration I net.sf.hibernate.cfg.Configuration processing one-to-many association mappings
[4/15/04 13:46:39:811 EDT] 7c066763 Binder I net.sf.hibernate.cfg.Binder Mapping collection: com.bunge.bgm.commodity.domain.Commodity.countriesOfOrigin -> Commodity_Country_of_Origin
[4/15/04 13:46:39:841 EDT] 7c066763 SystemErr R java.lang.NullPointerException

I am tring to save CommodityGroup and not the Commodity. But Commodity.hbm is causing a problem because of bag entry. Here are the contents of hbm file:

Commodity.hbm.xml
<?xml version="1.0"?>
<!--
$Id: Commodity.hbm.xml,v 1.3 2004/04/15 13:37:04 yogita Exp $
Last modification by $Author: yogita $
-->

<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="DB_COMMON">
<class name="com.bunge.bgm.commodity.domain.Commodity" table="COMMODITY">
<id name="CommodityID" column="Commodity_ID" unsaved-value="null" type="string">
<generator class="assigned"/>
</id>
<property name="CommodityName" column="Commodity_Name" not-null="true"/>
<property name="CommodityShortDescription" column="Commodity_Short_Description" not-null="true"/>
<property name="CommodityLongDescription" column="Commodity_Long_Description"/>
<property name="Status" column="Status" not-null="true"/>
<property name="Comments" column="Comments" />
<property name="CreatedBy" column="Created_By" not-null="true"/>
<property name="CreatedDate" column="Created_Date" not-null="true"/>
<property name="UpdateBy" column="Update_By" not-null="true"/>
<property name="UpdateDate" column="Update_Date" not-null="true"/>
<property name="CommodityGroupID" column="Commodity_Group_ID" type="string" not-null="true"/>
<property name="CommodityFamilyID" column="Commodity_Family_ID" type="string" not-null="true"/>
<!-- <many-to-one name="CommodityGroupID" column="Commodity_Group_ID" cascade="none"/> -->
<!-- <many-to-one name="CommodityFamilyID" column="Commodity_Family_ID" cascade="none"/> -->
<bag name="countriesOfOrigin" inverse="true" cascade="all" lazy="true">
<key column="Commodity_ID"/>
<one-to-many class="com.bunge.bgm.commodity.domain.CommodityCountryOfOrigin"/>
</bag>

<bag name="qualityFactors" inverse="true" cascade="all" lazy="true">
<key column="Commodity_ID"/>
<one-to-many class="com.bunge.bgm.commodity.domain.CommodityQualityFactor"/>
</bag>
</class>

</hibernate-mapping>


When bag entries are commented, program works fine and record is inserted into a database. But it gives aboe exception when bag is uncommented.

As mentioned above, I am trying to save CommodityGroup and not Commodity. Also here are the contents of CommodityGroup.hbm.xml:

<?xml version="1.0"?>
<!--
$Id: CommodityGroup.hbm.xml,v 1.2 2004/04/15 13:37:04 yogita Exp $
Last modification by $Author: yogita $
-->

<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping schema="BGM_COMMON">
<class name="com.bunge.bgm.commodity.domain.CommodityGroup" table="COMMODITY_GROUP">
<id name="CommodityGroupID" column="Commodity_Group_ID" unsaved-value="null" type="string">
<generator class="assigned"/>
</id>
<property name="CommodityGroupName" column="Commodity_Group_Name" not-null="true"/>
<property name="CommodityGroupDescription" column="Commodity_Group_Description"/>
<property name="Status" column="Status" not-null="true"/>
<property name="Comments" column="Comments" />
<property name="CreatedBy" column="Created_By" not-null="true"/>
<property name="CreatedDate" column="Created_Date" not-null="true"/>
<property name="UpdateBy" column="Update_By" not-null="true"/>
<property name="UpdateDate" column="Update_Date" not-null="true"/>
<!-- <set name="LnkCommdity">
<key column="Commodity_ID"/>
<one-to-many class="com.bunge.bgm.commodity.domain.Commodity"/>
</set>-->

</class>

</hibernate-mapping>

Thanks,
Gita


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.