-->
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: ERROR while using unsaved-value="id_value"
PostPosted: Mon Aug 23, 2004 1:32 am 
Beginner
Beginner

Joined: Thu Aug 19, 2004 5:20 am
Posts: 25
Hi

I try to use unsaved-value="id_value" and it gives the error below? any ideas?

P.S the mapping is included below



Mapping spec from the manual
<id
name="propertyName" (1)
type="typename" (2)
column="column_name" (3)
unsaved-value="any|none|null|id_value" (4)
access="field|property|ClassName"> (5)

<generator class="generatorClass"/>
</id>
[i]

[B]ERROR[B]

net.sf.hibernate.MappingException: Could not parse unsaved-value: id_value
at net.sf.hibernate.persister.AbstractEntityPersister.<init>(AbstractEntityPersister.java:515)
at net.sf.hibernate.persister.EntityPersister.<init>(EntityPersister.java:623)
at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:203)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:594)
at HibernateDBConnection.initialiseSessions(HibernateDBConnection.java:44)
at HibernateDBConnection.getSession(HibernateDBConnection.java:66)
at XMLTest.getQuery(XMLTest.java:44)
at XMLTest.main(XMLTest.java:268)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)







[B]CODE AND MAPPING EXAMPLE[B]
<hibernate-mapping>
<!-- <class name="DTrns" table="d_trns" dynamic-update="true" select-before-update="true">-->
<class name="DTrns" table="d_trns" dynamic-update="true">
<id name="trnID" column="trn_id" type ="java.lang.Long" unsaved-value="id_value">
<generator class="native" />
</id>
<property name="workGroupBranchID" column="wkgrp_brch_id" not-null="true"/>
</class>
</hibernate-mapping>
[i]


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 23, 2004 2:41 am 
Regular
Regular

Joined: Mon Oct 06, 2003 7:17 am
Posts: 58
Location: Switzerland
id_value means you have to set a value which defines an unsaved value. When your id is from type int you can define e.g 0 for your unsaved value (see also http://forum.hibernate.org/viewtopic.php?t=925345&highlight=idvalue))

Reto


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.