-->
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: MappingException problem
PostPosted: Fri Oct 29, 2004 9:07 am 
Newbie

Joined: Fri Oct 29, 2004 8:56 am
Posts: 1
I'm quite new to Hibernate, but I think I already got quite a good understanding of it. I tried to solve this problem for two full days now and hope that anyone of you could give me any tips.
I'm using the AppFuse simple and basic application, to get started. Everything is working as it is. Then I added a new model class, called Reservation.java. Here the hbm.xml I generated from it:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping
>
<class
name="com.apaara.apaaraFuseCore.model.reservations.Reservation"
table="reservations"
polymorphism="explicit"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
>

<id
name="id"
column="id"
type="long"
unsaved-value="version"
>
<generator class="identity">
</generator>
</id>

<discriminator
column="reservation_type"
/>

<version
name="version"
type="java.lang.Integer"
column="version"
access="property"
unsaved-value="undefined"
/>

<property
name="fromDate"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="fromDate"
/>

<property
name="toDate"
type="java.util.Date"
update="true"
insert="true"
access="property"
column="toDate"
/>

<subclass
name="com.apaara.apaaraFuseCore.model.reservations.RoomReservation"
dynamic-update="false"
dynamic-insert="false"
>
<property
name="roomId"
type="int"
update="true"
insert="true"
access="property"
column="roomId"
/>

</subclass>

</class>

</hibernate-mapping>

I added the necessary entries to applicationContext-hibernate.xml. Now, when I run the junit tests again, I get the following exception:

[junit] java.lang.ExceptionInInitializerError
[junit] at java.lang.Class.forName0(Native Method)
[junit] at java.lang.Class.forName(Class.java:141)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:204)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.<init>(JUnitTestRunner.java:177)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:651)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:537)
[junit] Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [WEB-INF/applicationContext-hibernate.xml]: Initialization of bean failed; nested exception is net.sf.hibernate.MappingException: Could not parse identifier unsaved-value: version
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:300)
[junit] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:205)
[junit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:204)
[junit] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:136)
[junit] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:230)
[junit] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:284)
[junit] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:80)
[junit] at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
[junit] at com.apaara.apaaraFuseCore.dao.BaseDAOTestCase.<clinit>(BaseDAOTestCase.java:35)
[junit] ... 6 more

What the hell is wrong with "Could not parse identifier unsaved-value: version"??? I got everything regarding version in my mapping file as far as I can see, don't I?

Appreciate any help


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.