-->
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: Differences between SQL generated by Hibern8IDE SQL generate
PostPosted: Tue Nov 23, 2004 2:50 pm 
Newbie

Joined: Mon Oct 18, 2004 11:35 am
Posts: 3
Hi,

I have tested a HQL query from Hibern8IDE with success, but when I have tested the same HQL Query in J2EE environment (IONA AppServer) it does not work.

Hibernate version:
2.1.6

Mapping documents:
I have used the same mapping file in the two tests:

<?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>

<class
name="com.winterthur.rps2.persist.persistenceobject.IntervinientesP"
table="RP2T_INTERVINIENTES"
>
<meta attribute="class-description" inherit="false">
@hibernate.class
table="RP2T_INTERVINIENTES"
</meta>

<id
name="itvPk"
type="java.math.BigDecimal"
column="ITV_PK"
>
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
type="java.math.BigDecimal"
column="ITV_PK"

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

<property
name="itvNcodrol"
type="int"
column="ITV_NCODROL"
not-null="true"
length="2"
>
<meta attribute="field-description">
@hibernate.property
column="ITV_NCODROL"
length="2"
not-null="true"
</meta>
</property>

<joined-subclass name="com.winterthur.rps2.persist.persistenceobject.HIntervinientesP" table="RP2T_HINTERVINIENTES">
<key column="HITV_ITV_FK"/>

<property
name="hitvPk"
type="java.math.BigDecimal"
column="HITV_PK"
>
<meta attribute="field-description">
@hibernate.id
generator-class="assigned"
type="java.math.BigDecimal"
column="HITV_PK"

</meta>

</property>

<property
name="hitvNversion"
type="int"
column="HITV_NVERSION"
not-null="true"
length="5"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_NVERSION"
length="5"
not-null="true"
</meta>
</property>
<property
name="hitvFiniciover"
type="java.sql.Timestamp"
column="HITV_FINICIOVER"
not-null="true"
length="7"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_FINICIOVER"
length="7"
not-null="true"
</meta>
</property>
<property
name="hitvSapellido1"
type="java.lang.String"
column="HITV_SAPELLIDO1"
not-null="true"
length="200"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_SAPELLIDO1"
length="200"
not-null="true"
</meta>
</property>
<property
name="hitvSapellido2"
type="java.lang.String"
column="HITV_SAPELLIDO2"
length="100"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_SAPELLIDO2"
length="100"
</meta>
</property>
<property
name="hitvSnombre"
type="java.lang.String"
column="HITV_SNOMBRE"
length="100"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_SNOMBRE"
length="100"
</meta>
</property>
<property
name="hitvScodsexo"
type="java.lang.String"
column="HITV_SCODSEXO"
length="1"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_SCODSEXO"
length="1"
</meta>
</property>
<property
name="hitvFnacimiento"
type="java.sql.Timestamp"
column="HITV_FNACIMIENTO"
length="7"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_FNACIMIENTO"
length="7"
</meta>
</property>
<property
name="hitvNidioma"
type="java.lang.Integer"
column="HITV_NIDIOMA"
length="1"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_NIDIOMA"
length="1"
</meta>
</property>
<property
name="hitvNcodcnae"
type="java.lang.Long"
column="HITV_NCODCNAE"
length="10"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_NCODCNAE"
length="10"
</meta>
</property>
<property
name="hitvNcodtipodocumento"
type="java.lang.Integer"
column="HITV_NCODTIPODOCUMENTO"
length="2"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_NCODTIPODOCUMENTO"
length="2"
</meta>
</property>
<property
name="hitvSnumdocumento"
type="java.lang.String"
column="HITV_SNUMDOCUMENTO"
length="240"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_SNUMDOCUMENTO"
length="240"
</meta>
</property>
<property
name="hitvScomentarios"
type="java.lang.String"
column="HITV_SCOMENTARIOS"
length="1000"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_SCOMENTARIOS"
length="1000"
</meta>
</property>
<property
name="hitvNidper"
type="java.math.BigDecimal"
column="HITV_NIDPER"
length="20"
>
<meta attribute="field-description">
@hibernate.property
column="HITV_NIDPER"
length="20"
</meta>
</property>
</joined-subclass>
</class>
</hibernate-mapping>

Full stack trace of any exception that occurs:

This is the HQL Query:

select hintervinientesp from HIntervinientesP as hintervinientesp where hintervinientesp.hitvNversion = 2

In Hibern8IDE test I don't have any error. IDE returns correctly the required object.

In J2EE environment: "Error performing iterater: More than one row with the given identifier was found: 1, for class: com.winterthur.rps2.persist.persistenceobject.HIntervinientesP"

This is the output:
[INFO] Environment - -Hibernate 2.1.6
[INFO] Environment - -hibernate.properties not found
[INFO] Environment - -using CGLIB reflection optimizer
[INFO] Environment - -JVM does not support Statement.getGeneratedKeys()
[INFO] Environment - -JVM does not support LinkedHasMap, LinkedHashSet - ordered maps and sets disabled
[INFO] Environment - -using workaround for JVM bug in java.sql.Timestamp
[INFO] Configuration - -configuring from resource: /hibernate.cfg.xml
[INFO] Configuration - -Configuration resource: /hibernate.cfg.xml
[INFO] Configuration - -Mapping resource: com/winterthur/rps2/persist/persistenceobject/Compania.hbm.xml
[INFO] Binder - -Mapping class: com.winterthur.rps2.persist.persistenceobject.Compania -> RP2T_MS_COMPANIAS
[INFO] Configuration - -Mapping resource: com/winterthur/rps2/negocio/CompaniaBO.hbm.xml
[INFO] Binder - -Mapping class: com.winterthur.rps2.negocio.CompaniaBO -> RP2T_MS_COMPANIAS
[INFO] Configuration - -Mapping resource: com/winterthur/rps2/persist/persistenceobject/EnteP.hbm.xml
[INFO] Binder - -Mapping class: com.winterthur.rps2.persist.persistenceobject.EnteP -> RP2T_POLIZAS
[INFO] Binder - -Mapping joined-subclass: com.winterthur.rps2.persist.persistenceobject.EnteHPolizaP -> RP2T_HPOLIZAS
[INFO] Configuration - -Mapping resource: com/winterthur/rps2/persist/persistenceobject/IntervinientesP.hbm.xml
[INFO] Binder - -Mapping class: com.winterthur.rps2.persist.persistenceobject.IntervinientesP -> RP2T_INTERVINIENTES
[INFO] Binder - -Mapping joined-subclass: com.winterthur.rps2.persist.persistenceobject.HIntervinientesP -> RP2T_HINTERVINIENTES
[INFO] Configuration - -Configured SessionFactory: null
[INFO] Configuration - -processing one-to-many association mappings
[INFO] Binder - -Mapping collection: com.winterthur.rps2.persist.persistenceobject.EnteP.IntervinientesP -> RP2T_INTERVINIENTES
[INFO] Configuration - -processing one-to-one association property references
[INFO] Configuration - -processing foreign key constraints
[INFO] Dialect - -Using dialect: net.sf.hibernate.dialect.Oracle9Dialect
[INFO] SettingsFactory - -Use outer join fetching: true
[WARN] UserSuppliedConnectionProvider - -No connection properties specified - the user must supply JDBC connections
[INFO] TransactionManagerLookupFactory - -No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
[INFO] SettingsFactory - -Use scrollable result sets: false
[INFO] SettingsFactory - -Use JDBC3 getGeneratedKeys(): false
[INFO] SettingsFactory - -Optimize cache for minimal puts: false
[INFO] SettingsFactory - -echoing all SQL to stdout
[INFO] SettingsFactory - -Query language substitutions: {}
[INFO] SettingsFactory - -cache provider: net.sf.ehcache.hibernate.Provider
[INFO] Configuration - -instantiating and configuring caches
[INFO] SessionFactoryImpl - -building session factory
[WARN] XMLDatabinder - -no XSLT implementation found - databinding disabled
[INFO] SessionFactoryObjectFactory - -Not binding factory to JNDI, no JNDI name configured
Hibernate: select hintervini0_.HITV_ITV_FK as x0_0_ from RP2T_HINTERVINIENTES hintervini0_ inner join RP2T_INTERVINIENTES hintervini0__1_ on hintervini0_.HITV_ITV_FK=hintervini0__1_.ITV_PK where (hintervini0_.HITV_NVERSION=? )
Hibernate: select hintervini0_.HITV_ITV_FK as ITV_PK0_, hintervini0_.HITV_PK as HITV_PK4_0_, hintervini0_.HITV_NVERSION as HITV_NVE3_4_0_, hintervini0_.HITV_FINICIOVER as HITV_FIN4_4_0_, hintervini0_.HITV_SAPELLIDO1 as HITV_SAP5_4_0_, hintervini0_.HITV_SAPELLIDO2 as HITV_SAP6_4_0_, hintervini0_.HITV_SNOMBRE as HITV_SNO7_4_0_, hintervini0_.HITV_SCODSEXO as HITV_SCO8_4_0_, hintervini0_.HITV_FNACIMIENTO as HITV_FNA9_4_0_, hintervini0_.HITV_NIDIOMA as HITV_NI10_4_0_, hintervini0_.HITV_NCODCNAE as HITV_NC11_4_0_, hintervini0_.HITV_NCODTIPODOCUMENTO as HITV_NC12_4_0_, hintervini0_.HITV_SNUMDOCUMENTO as HITV_SN13_4_0_, hintervini0_.HITV_SCOMENTARIOS as HITV_SC14_4_0_, hintervini0_.HITV_NIDPER as HITV_NI15_4_0_, hintervini0__1_.ITV_NCODROL as ITV_NCOD2_3_0_ from RP2T_HINTERVINIENTES hintervini0_ inner join RP2T_INTERVINIENTES hintervini0__1_ on hintervini0_.HITV_ITV_FK=hintervini0__1_.ITV_PK where hintervini0_.HITV_ITV_FK=?
ERRORjava.lang.RuntimeException: Error performing iterater: More than one row with the given identifier was found: 1, for class: com.winterthur.rps2.persist.persistenceobject.HIntervinientesP

Name and version of the database you are using:

Oracle 9i.

The generated SQL (show_sql=true):

In Hibern8IDE environment:
Hibernate: select hintervini0_.HITV_ITV_FK as ITV_PK, hintervini0_.HITV_PK as HITV_PK4_, hintervini0_.HITV_NVERSION as HITV_NVE3_4_, hintervini0_.HITV_FINICIOVER as HITV_FIN4_4_, hintervini0_.HITV_SAPELLIDO1 as HITV_SAP5_4_, hintervini0_.HITV_SAPELLIDO2 as HITV_SAP6_4_, hintervini0_.HITV_SNOMBRE as HITV_SNO7_4_, hintervini0_.HITV_SCODSEXO as HITV_SCO8_4_, hintervini0_.HITV_FNACIMIENTO as HITV_FNA9_4_, hintervini0_.HITV_NIDIOMA as HITV_NI10_4_, hintervini0_.HITV_NCODCNAE as HITV_NC11_4_, hintervini0_.HITV_NCODTIPODOCUMENTO as HITV_NC12_4_, hintervini0_.HITV_SNUMDOCUMENTO as HITV_SN13_4_, hintervini0_.HITV_SCOMENTARIOS as HITV_SC14_4_, hintervini0_.HITV_NIDPER as HITV_NI15_4_, hintervini0__1_.ITV_NCODROL as ITV_NCOD2_3_ from RP2T_HINTERVINIENTES hintervini0_ inner join RP2T_INTERVINIENTES hintervini0__1_ on hintervini0_.HITV_ITV_FK=hintervini0__1_.ITV_PK where (hintervini0_.HITV_NVERSION=2 )

In J2EE Environment, 2 selects:

Hibernate: select hintervini0_.HITV_ITV_FK as x0_0_ from RP2T_HINTERVINIENTES hintervini0_ inner join RP2T_INTERVINIENTES hintervini0__1_ on hintervini0_.HITV_ITV_FK=hintervini0__1_.ITV_PK where (hintervini0_.HITV_NVERSION=? )

Hibernate: select hintervini0_.HITV_ITV_FK as ITV_PK0_, hintervini0_.HITV_PK as HITV_PK4_0_, hintervini0_.HITV_NVERSION as HITV_NVE3_4_0_, hintervini0_.HITV_FINICIOVER as HITV_FIN4_4_0_, hintervini0_.HITV_SAPELLIDO1 as HITV_SAP5_4_0_, hintervini0_.HITV_SAPELLIDO2 as HITV_SAP6_4_0_, hintervini0_.HITV_SNOMBRE as HITV_SNO7_4_0_, hintervini0_.HITV_SCODSEXO as HITV_SCO8_4_0_, hintervini0_.HITV_FNACIMIENTO as HITV_FNA9_4_0_, hintervini0_.HITV_NIDIOMA as HITV_NI10_4_0_, hintervini0_.HITV_NCODCNAE as HITV_NC11_4_0_, hintervini0_.HITV_NCODTIPODOCUMENTO as HITV_NC12_4_0_, hintervini0_.HITV_SNUMDOCUMENTO as HITV_SN13_4_0_, hintervini0_.HITV_SCOMENTARIOS as HITV_SC14_4_0_, hintervini0_.HITV_NIDPER as HITV_NI15_4_0_, hintervini0__1_.ITV_NCODROL as ITV_NCOD2_3_0_ from RP2T_HINTERVINIENTES hintervini0_ inner join RP2T_INTERVINIENTES hintervini0__1_ on hintervini0_.HITV_ITV_FK=hintervini0__1_.ITV_PK where hintervini0_.HITV_ITV_FK=?



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.