-->
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.  [ 4 posts ] 
Author Message
 Post subject: one to one error
PostPosted: Fri Mar 11, 2005 3:51 am 
Regular
Regular

Joined: Sat Apr 10, 2004 8:39 pm
Posts: 84
=============SQLs========================

create table xtype (
symbol varchar(16) not null,
title varchar(30) default 'no title' not null,
note varchar(256),

primary key(symbol)
);


create table pigeonhole_type ( symbol varchar(16) not null,
title varchar(32) not null,
primary key(symbol)
);


create table pigeonhole_rule (
xtype_symbol varchar(16) not null,
pigeonhole_type_symbol varchar(16),
size integer default 1,
primary key(xtype_symbol),
foreign key(xtype_symbol) references xtype(symbol),
foreign key(pigeonhole_type_symbol) references pigeonhole_type(symbol)
);

IMAGE ByOwner 1
SB002 ByOwner 1
SB004 ByOwner 1


================mapping=====================

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

<hibernate-mapping>
<!--
Created by the Middlegen Hibernate plugin 2.1

http://boss.bekk.no/boss/middlegen/
http://www.hibernate.org/
-->

<class
name="com.fjky.xfile.core.orm.Xtype"
table="XTYPE"
>
<meta attribute="class-description" inherit="false">
@hibernate.class
table="XTYPE"
</meta>

<id
name="symbol"
type="java.lang.String"
column="SYMBOL"
>
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
type="java.lang.String"
column="SYMBOL"

</meta>
<generator class="assigned" />
</id>

<property
name="title"
type="java.lang.String"
column="TITLE"
not-null="true"
length="30"
>
<meta attribute="field-description">
@hibernate.property
column="TITLE"
length="30"
not-null="true"
</meta>
</property>
<property
name="note"
type="java.lang.String"
column="NOTE"
length="256"
>
<meta attribute="field-description">
@hibernate.property
column="NOTE"
length="256"
</meta>
</property>

<!-- Associations -->

<!-- bi-directional one-to-one association to PigeonholeRule -->
<one-to-one
name="pigeonholeRule"
class="com.fjky.xfile.core.orm.PigeonholeRule"
outer-join="auto"
>
<meta attribute="field-description">
@hibernate.one-to-one
outer-join="auto"
</meta>
</one-to-one>
<!-- bi-directional one-to-many association to XtypeDefaultAction -->
<set
name="xtypeDefaultActions"
lazy="true"
inverse="true"
cascade="none"
>
<meta attribute="field-description">
@hibernate.set
lazy="true"
inverse="true"
cascade="none"

@hibernate.collection-key
column="SYMBOL"

@hibernate.collection-one-to-many
class="com.fjky.xfile.core.orm.XtypeDefaultAction"
</meta>
<key>
<column name="SYMBOL" />
</key>
<one-to-many
class="com.fjky.xfile.core.orm.XtypeDefaultAction"
/>
</set>
<!-- bi-directional one-to-many association to Xource -->
<set
name="xources"
lazy="true"
inverse="true"
cascade="none"
>
<meta attribute="field-description">
@hibernate.set
lazy="true"
inverse="true"
cascade="none"

@hibernate.collection-key
column="XTYPE_SYMBOL"

@hibernate.collection-one-to-many
class="com.fjky.xfile.core.orm.Xource"
</meta>
<key>
<column name="XTYPE_SYMBOL" />
</key>
<one-to-many
class="com.fjky.xfile.core.orm.Xource"
/>
</set>
<!-- bi-directional one-to-many association to XtypeAction -->
<set
name="xtypeActions"
lazy="true"
inverse="true"
cascade="none"
>
<meta attribute="field-description">
@hibernate.set
lazy="true"
inverse="true"
cascade="none"

@hibernate.collection-key
column="SYMBOL"

@hibernate.collection-one-to-many
class="com.fjky.xfile.core.orm.XtypeAction"
</meta>
<key>
<column name="SYMBOL" />
</key>
<one-to-many
class="com.fjky.xfile.core.orm.XtypeAction"
/>
</set>

</class>
</hibernate-mapping>

=============================================

[WARN ] [2005-03-11 15:27:25,879] net.sf.ehcache.config.Configurator - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/WORK/fjky-fzgs/project/web/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
Hibernate: select xtype0_.SYMBOL as x0_0_ from XTYPE xtype0_ where (xtype0_.SYMBOL=? )
Hibernate: select xtype0_.SYMBOL as SYMBOL2_, xtype0_.TITLE as TITLE2_, xtype0_.NOTE as NOTE2_, pigeonhole1_.XTYPE_SYMBOL as XTYPE_SY1_0_, pigeonhole1_.SIZE as SIZE0_, pigeonhole1_.PIGEONHOLE_TYPE_SYMBOL as PIGEONHO3_0_, pigeonhole2_.SYMBOL as SYMBOL1_, pigeonhole2_.TITLE as TITLE1_ from XTYPE xtype0_ left outer join PIGEONHOLE_RULE pigeonhole1_ on xtype0_.SYMBOL=pigeonhole1_.XTYPE_SYMBOL left outer join PIGEONHOLE_TYPE pigeonhole2_ on pigeonhole1_.PIGEONHOLE_TYPE_SYMBOL=pigeonhole2_.SYMBOL where xtype0_.SYMBOL=?
Hibernate: select pigeonhole0_.XTYPE_SYMBOL as XTYPE_SY1_2_, pigeonhole0_.SIZE as SIZE2_, pigeonhole0_.PIGEONHOLE_TYPE_SYMBOL as PIGEONHO3_2_, xtype1_.SYMBOL as SYMBOL0_, xtype1_.TITLE as TITLE0_, xtype1_.NOTE as NOTE0_, pigeonhole2_.SYMBOL as SYMBOL1_, pigeonhole2_.TITLE as TITLE1_ from PIGEONHOLE_RULE pigeonhole0_ left outer join XTYPE xtype1_ on pigeonhole0_.XTYPE_SYMBOL=xtype1_.SYMBOL left outer join PIGEONHOLE_TYPE pigeonhole2_ on pigeonhole0_.PIGEONHOLE_TYPE_SYMBOL=pigeonhole2_.SYMBOL where pigeonhole0_.PIGEONHOLE_TYPE_SYMBOL=?
org.springframework.orm.hibernate.HibernateSystemException: More than one row with the given identifier was found: ByOwner, for class: hibernate.PigeonholeRule; nested exception is net.sf.hibernate.HibernateException: More than one row with the given identifier was found: ByOwner, for class: hibernate.PigeonholeRule
net.sf.hibernate.HibernateException: More than one row with the given identifier was found: ByOwner, for class: hibernate.PigeonholeRule
..............
Hibernate: select pigeonhole0_.XTYPE_SYMBOL as x0_0_ from PIGEONHOLE_RULE pigeonhole0_ where ((pigeonhole0_.XTYPE_SYMBOL=? ))
Hibernate: select pigeonhole0_.XTYPE_SYMBOL as XTYPE_SY1_2_, pigeonhole0_.SIZE as SIZE2_, pigeonhole0_.PIGEONHOLE_TYPE_SYMBOL as PIGEONHO3_2_, xtype1_.SYMBOL as SYMBOL0_, xtype1_.TITLE as TITLE0_, xtype1_.NOTE as NOTE0_, pigeonhole2_.SYMBOL as SYMBOL1_, pigeonhole2_.TITLE as TITLE1_ from PIGEONHOLE_RULE pigeonhole0_ left outer join XTYPE xtype1_ on pigeonhole0_.XTYPE_SYMBOL=xtype1_.SYMBOL left outer join PIGEONHOLE_TYPE pigeonhole2_ on pigeonhole0_.PIGEONHOLE_TYPE_SYMBOL=pigeonhole2_.SYMBOL where pigeonhole0_.XTYPE_SYMBOL=?
Hibernate: select pigeonhole0_.XTYPE_SYMBOL as XTYPE_SY1_2_, pigeonhole0_.SIZE as SIZE2_, pigeonhole0_.PIGEONHOLE_TYPE_SYMBOL as PIGEONHO3_2_, xtype1_.SYMBOL as SYMBOL0_, xtype1_.TITLE as TITLE0_, xtype1_.NOTE as NOTE0_, pigeonhole2_.SYMBOL as SYMBOL1_, pigeonhole2_.TITLE as TITLE1_ from PIGEONHOLE_RULE pigeonhole0_ left outer join XTYPE xtype1_ on pigeonhole0_.XTYPE_SYMBOL=xtype1_.SYMBOL left outer join PIGEONHOLE_TYPE pigeonhole2_ on pigeonhole0_.PIGEONHOLE_TYPE_SYMBOL=pigeonhole2_.SYMBOL where pigeonhole0_.PIGEONHOLE_TYPE_SYMBOL=?

_________________
I am the creatxr of world.


Top
 Profile  
 
 Post subject: Re: one to one error
PostPosted: Fri Mar 11, 2005 4:22 am 
Regular
Regular

Joined: Sat Apr 10, 2004 8:39 pm
Posts: 84
worldcreatxr wrote:
=============SQLs========================
<one-to-one
name="pigeonholeRule"
class="com.fjky.xfile.core.orm.PigeonholeRule"
outer-join="auto"
>
<meta attribute="field-description">
@hibernate.one-to-one
outer-join="auto"
</meta>
</one-to-one>
<!-- bi-directional one-to-many association to XtypeDefaultAction -->



error when load xtype by primary key.

session = sessionFactory.openSession();
Query query = session.createQuery("from Xtype xtype where xtype.symbol=:symbol");
query.setString("symbol", symbol);
Iterator it = query.iterate();
if (it.hasNext()) {
return (Xtype) it.next();
} else {
return null;
}

_________________
I am the creatxr of world.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 11, 2005 4:47 am 
Regular
Regular

Joined: Sat Apr 10, 2004 8:39 pm
Posts: 84
net.sf.hibernate.HibernateException: More than one row with the given identifier was found: ByOwner, for class: hibernate.PigeonholeRule

_________________
I am the creatxr of world.


Top
 Profile  
 
 Post subject: Re: one to one error
PostPosted: Fri Mar 11, 2005 5:56 am 
Regular
Regular

Joined: Sat Apr 10, 2004 8:39 pm
Posts: 84
worldcreatxr wrote:
org.springframework.orm.hibernate.HibernateSystemException: More than one row with the given identifier was found: ByOwner, for class: hibernate.PigeonholeRule; nested exception is net.sf.hibernate.HibernateException: More than one row with the given identifier was found: ByOwner, for class: hibernate.PigeonholeRule
net.sf.hibernate.HibernateException: More than one row with the given identifier was found: ByOwner, for class: hibernate.PigeonholeRule


I don't know why casted this error message.

_________________
I am the creatxr of world.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.