-->
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: Composite ID: "No Persister" error
PostPosted: Thu Dec 02, 2004 12:50 pm 
Newbie

Joined: Wed Oct 20, 2004 6:51 pm
Posts: 2
Hibernate version:
Hibernate 2.1

Mapping documents:
<class
name="ngv.hibernate.NgvLocation"
table="NGV_LOCATION"
>

<composite-id name="comp_id" class="ngv.hibernate.NgvLocationPK">
<key-property
name="warehouseid"
column="WAREHOUSEID"
type="java.lang.String"
length="25"
/>
<key-property
name="locationid"
column="LOCATIONID"
type="java.lang.String"
length="25"
/>
</composite-id>

<property
name="locationconfirmation"
type="java.lang.String"
column="LOCATIONCONFIRMATION"
length="1"
/>
<property
name="confirmationtype"
type="java.lang.String"
column="CONFIRMATIONTYPE"
length="32"
/>
<property
name="locationcoordinatedescr"
type="java.lang.String"
column="LOCATIONCOORDINATEDESCR"
length="64"
/>
<property
name="groupingmask"
type="java.math.BigDecimal"
column="GROUPINGMASK"
length="22"
/>
<property
name="confirmationmask"
type="java.math.BigDecimal"
column="CONFIRMATIONMASK"
length="22"
/>
<property
name="persistencemask"
type="java.math.BigDecimal"
column="PERSISTENCEMASK"
length="22"
/>
<property
name="filler"
type="java.lang.String"
column="FILLER"
length="32"
/>

<!-- Associations -->
<!-- derived association(s) for compound key -->
<!-- bi-directional many-to-one association to NgvWarehouse -->
<many-to-one
name="ngvWarehouse"
class="ngv.hibernate.NgvWarehouse"
update="false"
insert="false"
>
<column name="WAREHOUSEID" />
</many-to-one>

<!-- end of derived association(s) -->

<!-- bi-directional one-to-many association to NgvLocationAttribute -->
<set
name="ngvLocationAttributes"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="LOCATIONID" />
<column name="WAREHOUSEID" />
</key>
<one-to-many
class="ngv.hibernate.NgvLocationAttribute"
/>
</set>
<!-- bi-directional one-to-many association to NgvZoneLocation -->
<set
name="ngvZoneLocations"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="LOCATIONID" />
<column name="WAREHOUSEID" />
</key>
<one-to-many
class="ngv.hibernate.NgvZoneLocation"
/>
</set>
<!-- bi-directional one-to-many association to NgvTask -->
<set
name="ngvTasks"
lazy="true"
inverse="true"
cascade="none"
>
<key>
<column name="LOCATIONID" />
<column name="WAREHOUSEID" />
</key>
<one-to-many
class="ngv.hibernate.NgvTask"
/>
</set>

</class>

Code between sessionFactory.openSession() and session.close():

public static String NGV_LOCATION_BY_LOCATIONID =
" FROM com.voxware.orm.NgvLocation " +
" as location WHERE location.comp_id = ? ";

public NgvLocation getNgvLocationByLocationId(String warehouseid,String locationid)
throws HibernateException {

Session session = getSessionFactory().openSession();

NgvLocation location = null;
NgvLocationPK compid = new NgvLocationPK();
compid.setWarehouseid(warehouseid);
compid.setLocationid(locationid);

try {

ArrayList list = new ArrayList();

list = (ArrayList) session.find(
NGV_LOCATION_BY_LOCATIONID,
compid,
Hibernate.entity(NgvLocationPK.class)
);

//if ( (list.isEmpty() || list.size() != 1) ){
if (! list.isEmpty() ){
location = (NgvLocation) list.get(0);
}

} catch (HibernateException he){
he.printStackTrace();
} catch (Exception e){
e.printStackTrace();
} finally {
session.close();
}

return location;
}


Full stack trace of any exception that occurs:
11:07:27,709 INFO [STDOUT] net.sf.hibernate.MappingException: No persister for: com.voxware.orm.NgvLocationPK
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:344)
at net.sf.hibernate.type.EntityType.toString(EntityType.java:79)
at net.sf.hibernate.impl.Printer.toString(Printer.java:57)
at net.sf.hibernate.engine.QueryParameters.traceParameters(QueryParameters.java:106)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1527)

Name and version of the database you are using:
Oracle 9i

Any help is much appreciated.

Thanks
Krishna


Top
 Profile  
 
 Post subject: Composite ID: "No Persister" error
PostPosted: Sun Jan 09, 2005 9:16 pm 
Beginner
Beginner

Joined: Fri Jan 07, 2005 11:07 am
Posts: 30
make sure your persistent classes are specified
either in the following:

Configuration config = new Configuration();

config.addClass(XYZ.class).addClass(XXXX.class);

or they need to be specified in the cfg.xml file.

pete


Top
 Profile  
 
 Post subject: i ahve the same problem
PostPosted: Wed Jan 19, 2005 10:00 am 
Newbie

Joined: Mon Jan 17, 2005 9:05 am
Posts: 17
I think primary key class does not need to new Configuration().addClass(), isn't it? I have the same problem on inserting new data using composite key into table. Could anyone help?


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.