-->
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: Unit test bleiben hängen, bei dao.saveOrUpdate(user);
PostPosted: Wed Sep 14, 2005 6:08 am 
Beginner
Beginner

Joined: Fri May 21, 2004 3:49 pm
Posts: 21
Location: Germany, Mainz
Hibernate version: 3

Mapping documents:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="clara.bo.model">
<class name="User" table="USERS" schema="BLOG">

<id name="id"
type="long"
column="ID"
unsaved-value="null"
access="field">
<generator class="native" />
</id>

<property name="name"
type="string"
insert="true"
update="false">
<column name="NAME"
not-null="true"
length="255"
unique-key="UK_USER_NAME" />
</property>

<property name="password"
type="string">
<column name="PASSWORD"
not-null="true"
length="255"/>
</property>

<property name="nationality"
type="string">
<column name="NATIONALITY"
not-null="true"
length="200" />
</property>

<property name="origin"
type="string">
<column name="ORIGIN"
not-null="true"
length="200" />
</property>

<property name="realname"
type="string">
<column name="REALNAME"
not-null="true"
length="255"/>
</property>

<property name="surname"
type="string">
<column name="surname"
not-null="true"
length="255"/>
</property>

<property name="signature"
type="text">
<column name="SIGNATURE"
not-null="true"
length="255"/>
</property>

<property name="url"
type="string">
<column name="URL"
not-null="true"
length="255"/>
</property>

<property name="timezone"
type="timezone">
<column name="TIMEZONE"
not-null="true"/>
</property>

<property name="email"
type="string">
<column name="EMAIL"
not-null="true"
length="255"/>
</property>

<property name="deflang"
type="string">
<column name="DEFLANG"
not-null="true"
length="255"/>
</property>

<property name="admin"
type="true_false">
<column name="ADMIN"
not-null="true"/>
</property>

<property name="adminarea"
type="integer">
<column name="ADMINAREA"
not-null="true"/>
</property>
</class>
</hibernate-mapping>

Full stack trace of any exception that occurs: No exception

Name and version of the database you are using: Oracle 10g2

The generated SQL (show_sql=true):


2005-09-14 12:03:30,329 [main] DEBUG - Inserting entity: [clara.bo.model.User#88]
2005-09-14 12:03:30,329 [main] DEBUG - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
2005-09-14 12:03:30,329 [main] DEBUG - insert into BLOG.USERS (NAME, PASSWORD, NATIONALITY, ORIGIN, REALNAME, surname, SIGNATURE, URL, TIMEZONE, EMAIL, DEFLANG, ADMIN, ADMINAREA, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into BLOG.USERS (NAME, PASSWORD, NATIONALITY, ORIGIN, REALNAME, surname, SIGNATURE, URL, TIMEZONE, EMAIL, DEFLANG, ADMIN, ADMINAREA, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2005-09-14 12:03:30,329 [main] DEBUG - preparing statement
2005-09-14 12:03:30,329 [main] DEBUG - Dehydrating entity: [clara.bo.model.User#88]
2005-09-14 12:03:30,329 [main] DEBUG - binding 'Hiemer' to parameter: 1
2005-09-14 12:03:30,329 [main] DEBUG - binding 'valentin' to parameter: 2
2005-09-14 12:03:30,329 [main] DEBUG - binding 'German' to parameter: 3
2005-09-14 12:03:30,329 [main] DEBUG - binding 'Germany' to parameter: 4
2005-09-14 12:03:30,329 [main] DEBUG - binding 'Johannes' to parameter: 5
2005-09-14 12:03:30,329 [main] DEBUG - binding 'Valentin' to parameter: 6
2005-09-14 12:03:30,329 [main] DEBUG - binding 'kjhiuiuvuvutvzzt' to parameter: 7
2005-09-14 12:03:30,329 [main] DEBUG - binding 'http://www.planet-tutorials.de' to parameter: 8
2005-09-14 12:03:30,329 [main] DEBUG - binding 'Europe/Berlin' to parameter: 9
2005-09-14 12:03:30,329 [main] DEBUG - binding 'johannes.hiemer@itecon.de' to parameter: 10
2005-09-14 12:03:30,329 [main] DEBUG - binding 'de_DE' to parameter: 11
2005-09-14 12:03:30,329 [main] DEBUG - binding 'true' to parameter: 12
2005-09-14 12:03:30,329 [main] DEBUG - binding '0' to parameter: 13
2005-09-14 12:03:30,329 [main] DEBUG - binding '88' to parameter: 14
2005-09-14 12:03:30,329 [main] DEBUG - Adding to batch
2005-09-14 12:03:30,329 [main] DEBUG - Executing batch size: 1

Debug level Hibernate log excerpt: debug

Hi,
as you can see from the topic I have got a problem with my unittests. They run properly till the first userDao.saveOrUpdate(user); is called, then the output above is produced no data was inserted into the database and the unittest stops to proceed without any error-message.

Did anyone have a similiar thing?

Thanks a lot for your help.

Regards Johannes


Top
 Profile  
 
 Post subject: Problem solved.
PostPosted: Thu Sep 15, 2005 3:20 am 
Beginner
Beginner

Joined: Fri May 21, 2004 3:49 pm
Posts: 21
Location: Germany, Mainz
Mapping from team to user stopped excution:
Code:
<many-to-one name="user"
                class="User"
                access="property"
                insert="false"
                update="false"
                not-null="true"
                cascade="save-update, merge"
                foreign-key="FK_TEAM_USER">
            <column name="ID"
                  not-null="true"/>
      </many-to-one>


Removing merge fixed it.

Code:
<many-to-one name="user"
                class="User"
                access="property"
                insert="false"
                update="false"
                not-null="true"
                cascade="save-update"
                foreign-key="FK_TEAM_USER">
            <column name="ID"
                  not-null="true"/>
      </many-to-one>


Thanks a lot.


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.