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 loading entities mapped to a table with no index
PostPosted: Fri Aug 31, 2012 3:23 pm 
Newbie

Joined: Fri Aug 31, 2012 2:38 pm
Posts: 1
Hi I have a problem loading entities are mapped to a table with no index so the issue is that I get duplicate rows! The configuration is the following:

XML File:

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

<hibernate-mapping package="com.mappings" schema="prospects">
<class
name="ProspectBackground"
table="PROSPECT_BACKGROUND"
lazy="false"
>
<meta attribute="sync-DAO">false</meta>

<id
name="IdProspect"
column="ID_PROSPECT"
type="integer"

length="10"
>
<generator class="assigned" />
</id>
<property
name="IdBackground"
column="ID_BACKGROUND"
type="integer"
not-null="true"
length="10"
/>
<property
name="Answer"
column="ANSWER"
type="string"
not-null="true"
length="3"
/>
<property
name="Timestamp"
column="TIMESTAMP"
type="timestamp"
not-null="false"
length="26"
/>
</class>
</hibernate-mapping>

The table has the following rows:

ID_PROSPECT ID_BACKGROUND ANSWER TIMESTAMP
715 1 YES 2012-08-27 11:36:29.404
715 2 YES 2012-08-27 11:36:29.471
716 1 NO 2012-08-27 13:07:57.144
716 2 NO 2012-08-27 13:07:57.225
717 1 YES 2012-08-27 13:31:16.193
717 2 YES 2012-08-27 13:31:16.244
718 1 YES 2012-08-27 13:35:54.783
718 2 YES 2012-08-27 13:35:54.847
719 1 NO 2012-08-27 14:06:51.822
719 2 NO 2012-08-27 14:06:51.887
720 1 NO 2012-08-27 18:50:54.043
720 2 NO 2012-08-27 18:50:54.123

But when I execute the query: from ProspectBackground I get the following records:

715 1 YES 2012-08-27 11:36:29.404
715 1 YES 2012-08-27 11:36:29.404
716 1 NO 2012-08-27 13:07:57.144
716 1 NO 2012-08-27 13:07:57.144
717 1 YES 2012-08-27 13:31:16.193
717 1 YES 2012-08-27 13:31:16.193
718 1 YES 2012-08-27 13:35:54.783
718 1 YES 2012-08-27 13:35:54.783
719 1 NO 2012-08-27 14:06:51.822
719 1 NO 2012-08-27 14:06:51.822
720 1 NO 2012-08-27 18:50:54.043
720 1 NO 2012-08-27 18:50:54.043

I'm getting twice the first record of the same ID_PROSPECT so should I need to add an index column to the table to obtain also the records with the column: TIMESTAMP = 2? Can you give an advice please?

Thanks in advance!


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.