-->
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.  [ 8 posts ] 
Author Message
 Post subject: 4 or more many-to-one relationships result in error on load
PostPosted: Tue Jul 26, 2005 9:46 pm 
Newbie

Joined: Mon Jul 26, 2004 2:52 pm
Posts: 11
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

We have a scenario where object A is referring to Object B. Object B has 4 many-to-one relationships to other objects. We seem to get array out of bounds error when we try to load A by id. We are able to load B by id. Please see an example of B hbm. The stack with the SQL is atatched.

Hibernate version:
2.1.4

Mapping documents:
<?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.macrovision.flexnet.products.bizobjects.LicenseModel" table="PROD_LICENSE_MODEL">
<meta attribute="class-description">
</meta>
<meta attribute="generated-class">com.macrovision.flexnet.products.entities.LicenseModelData</meta>
<meta attribute="extends">com.macrovision.flexnet.platform.entities.Entity</meta>
<meta attribute="implements" inherit="false">com.macrovision.flexnet.products.bizobjects.IRecentlyAccessed</meta>
<meta attribute="implement-equals">true</meta>

<cache usage="read-write"/>

<id name="id" type="long" column="ID" unsaved-value="null">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
<timestamp name="lastModified" column="LAST_MODIFIED" unsaved-value="null"/>
<property name="createdOn" column="CREATED_ON" type="timestamp" not-null="true">
<meta attribute="scope-set">protected</meta>
</property>

<property name="name" unique="true" column="NAME" type="string" length="64" not-null="true">
<meta attribute="field-description">
Unique name used to identify this model.
</meta>
<meta attribute="use-in-equals">true</meta>
</property>

<property name="description" column="DESCRIPTION" type="string" length="2000">
<meta attribute="field-description">
Human readable description of the product feature.
</meta>
</property>

<property name="status_" column="STATUS" type="string" length="32" not-null="true">
<meta attribute="field-description">
Current state; one of "draft" "deployed" "inactive" "obsolete".
</meta>
<meta attribute="scope">protected</meta>
<meta attribute="use-in-equals">true</meta>
</property>

<property name="modelType_" column="MODEL_TYPE" type="string" length="32" not-null="true">
<meta attribute="field-description">
Defines the type of license model:
"FLOATING_CERTIFICATE", "NODE_LOCKED",
"RETAIL_ACTIVATION", "ENTERPRISE_ACTIVATION",
"FLOATING_TRANSFER", "FLOATING_BORROW"
</meta>
<meta attribute="scope">protected</meta>
</property>

<property name="duration_" column="DURATION" type="java.lang.Integer">
<meta attribute="scope">protected</meta>
</property>

<property name="durationUnits_" column="DURATION_UNITS" type="string" length="64">
<meta attribute="scope">protected</meta>
</property>

<property name="counted_" column="COUNTED" type="boolean" not-null="true">
<meta attribute="scope">protected</meta>
</property>

<property name="licGenerator_" column="LIC_GENERATOR" type="string" length="64" not-null="true">
<meta attribute="scope">protected</meta>
<meta attribute="use-in-equals">true</meta>
</property>

<property name="licenseType_" column="LICENSE_TYPE" type="string" length="32" not-null="true">
<meta attribute="scope">protected</meta>
</property>

<property name="packageOption_" column="PACKAGE_OPTION" type="string" length="32" not-null="true">
<meta attribute="scope">protected</meta>
</property>

<property name="dupGrouping" column="DUP_GROUPING" type="string" length="32">
<meta attribute="scope">protected</meta>
</property>

<many-to-one name="rehostsLifecyclePolicy_" column="REHOSTS_LIFECYCLE_POLICY"
class="com.macrovision.flexnet.products.bizobjects.LifecyclePolicy" cascade="delete">
<meta attribute="field-description">
This stores the rehosts lifecycle policy
</meta>
</many-to-one>

<many-to-one name="returnsLifecyclePolicy_" column="RETURNS_LIFECYCLE_POLICY"
class="com.macrovision.flexnet.products.bizobjects.LifecyclePolicy" cascade="delete">
<meta attribute="field-description">
This stores the returns lifecycle policy
</meta>
</many-to-one>

<many-to-one name="repairsLifecyclePolicy_" column="REPAIRS_LIFECYCLE_POLICY"
class="com.macrovision.flexnet.products.bizobjects.LifecyclePolicy" cascade="delete">
<meta attribute="field-description">
This stores the repairs lifecycle policy
</meta>
</many-to-one>

<many-to-one name="activationsLifecyclePolicy_" column="ACTIVATIONS_LIFECYCLE_POLICY"
class="com.macrovision.flexnet.products.bizobjects.LifecyclePolicy" cascade="delete">
<meta attribute="field-description">
This stores the activations lifecycle policy
</meta>
</many-to-one>

<many-to-one name="extendedPropertySet" column="PROPERTIES"
class="com.macrovision.flexnet.platform.bizobjects.ExtendedPropertySet"
cascade="delete">
<meta attribute="field-description">
This set stores values for generator-specific properties that are resolved by the model.
</meta>
</many-to-one>
<map name="extendedPropertyConfig" table="PROD_MODEL_PROPERTY_CONFIG" cascade="delete">
<meta attribute="field-description">
This map defines what enitity class should set each generator property
</meta>
<key column="MODEL_ID"/>
<index column="PROPERTY_NAME" type="string" length="255"/>
<element column="WHEN_SET" type="string"/>
</map>
</class>
</hibernate-mapping>


Name and version of the database you are using:
Oracle 9i
Inet 2.0.9 JDBC driver

The generated SQL (show_sql=true):

select certificat0_.ID as ID6_, certificat0_.LAST_MODIFIED as LAST_MOD3_6_, certificat0_.FULFILLMENT_ID as FULFILLM4_6_, certificat0_.FULFILLMENT_TYPE as FULFILLM2_6_, certificat0_.STATUS as STATUS6_, certificat0_.LIFECYCLE_STATUS as LIFECYCL6_6_, certificat0_.START_DATE as START_DATE6_, certificat0_.EXPIRATION_DATE as EXPIRATI8_6_, certificat0_.ACTIVATION_COUNT as ACTIVATI9_6_, certificat0_.ACTIVE_COUNT as ACTIVE_10_6_, certificat0_.OVERDRAFT_COUNT as OVERDRA11_6_, certificat0_.TRUSTED_ACTIVATION_COUNT as TRUSTED12_6_, certificat0_.TRUSTED_ACTIVATION_OVERDRAFT as TRUSTED13_6_, certificat0_.TRUSTED_CONCURRENT_COUNT as TRUSTED14_6_, certificat0_.TRUSTED_CONCURRENT_OVERDRAFT as TRUSTED15_6_, certificat0_.TRUSTED_HYBRID_COUNT as TRUSTED16_6_, certificat0_.TRUSTED_HYBRID_OVERDRAFT as TRUSTED17_6_, certificat0_.ACTIVATION_DATE as ACTIVAT18_6_, certificat0_.ACTIVATION_DURATION as ACTIVAT19_6_, certificat0_.DURATION_UNITS as DURATIO20_6_, certificat0_.EXTENDED_PROPERTIES as EXTENDE21_6_, certificat0_.ENTITLEMENT_ITEM as ENTITLE22_6_, certificat0_.ENTITLEMENT_LINEITEM as ENTITLE23_6_, certificat0_.PARENT_FULFILLMENT as PARENT_24_6_, certificat0_.LICENSED_PRODUCT as LICENSE25_6_, certificat0_.LICENSE_MODEL as LICENSE26_6_, certificat0_.LICENSE_TEXT as LICENSE27_6_, certificat0_.SHIP_TO_EMAIL as SHIP_TO28_6_, certificat0_.SHIP_TO_ADDRESS as SHIP_TO29_6_, extendedpr1_.ID as ID0_, extendedpr1_.LASTUPDATED as LASTUPDA2_0_, entitlemen2_.ID as ID1_, entitlemen2_.LAST_MODIFIED as LAST_MOD2_1_, entitlemen2_.CREATED_ON as CREATED_ON1_, entitlemen2_.LICENSEDPRODUCT_COUNT as LICENSED4_1_, entitlemen2_.OVERDRAFT_COUNT as OVERDRAF5_1_, entitlemen2_.OVERDRAFT_FULFILLED as OVERDRAF6_1_, entitlemen2_.LICENSEDPRODUCT_ID as LICENSED7_1_, entitlemen2_.LICENSEMODEL_ID as LICENSEM8_1_, entitlemen2_.FULFILLED_AMOUNT as FULFILLE9_1_, entitlemen2_.EXTENDED_PROPERTIES as EXTENDE10_1_, entitlemen2_.ENTITLEMENT_ID as ENTITLE11_1_, entitlemen3_.ID as ID2_, entitlemen3_.ORDER_ID as ORDER_ID2_, entitlemen3_.LAST_MODIFIED as LAST_MOD3_2_, entitlemen3_.CREATED_ON as CREATED_ON2_, entitlemen3_.ENTITLEMENT_LINE_ITEM_ID as ENTITLEM5_2_, entitlemen3_.IS_ACTIVATABLE as IS_ACTIV6_2_, entitlemen3_.IS_BULK_LINE_ITEM as IS_BULK_7_2_, entitlemen3_.ENTITLEMENT_PRODUCT_ID as ENTITLEM8_2_, entitlemen3_.PARENT_ENTITLEMENT_ID as PARENT_E9_2_, activation4_.ID as ID3_, activation4_.FULFILLMENT_TYPE as FULFILLM2_3_, activation4_.LAST_MODIFIED as LAST_MOD3_3_, activation4_.FULFILLMENT_ID as FULFILLM4_3_, activation4_.STATUS as STATUS3_, activation4_.LIFECYCLE_STATUS as LIFECYCL6_3_, activation4_.START_DATE as START_DATE3_, activation4_.EXPIRATION_DATE as EXPIRATI8_3_, activation4_.ACTIVATION_COUNT as ACTIVATI9_3_, activation4_.ACTIVE_COUNT as ACTIVE_10_3_, activation4_.OVERDRAFT_COUNT as OVERDRA11_3_, activation4_.TRUSTED_ACTIVATION_COUNT as TRUSTED12_3_, activation4_.TRUSTED_ACTIVATION_OVERDRAFT as TRUSTED13_3_, activation4_.TRUSTED_CONCURRENT_COUNT as TRUSTED14_3_, activation4_.TRUSTED_CONCURRENT_OVERDRAFT as TRUSTED15_3_, activation4_.TRUSTED_HYBRID_COUNT as TRUSTED16_3_, activation4_.TRUSTED_HYBRID_OVERDRAFT as TRUSTED17_3_, activation4_.ACTIVATION_DATE as ACTIVAT18_3_, activation4_.ACTIVATION_DURATION as ACTIVAT19_3_, activation4_.DURATION_UNITS as DURATIO20_3_, activation4_.EXTENDED_PROPERTIES as EXTENDE21_3_, activation4_.ENTITLEMENT_ITEM as ENTITLE22_3_, activation4_.ENTITLEMENT_LINEITEM as ENTITLE23_3_, activation4_.PARENT_FULFILLMENT as PARENT_24_3_, activation4_.LICENSED_PRODUCT as LICENSE25_3_, activation4_.LICENSE_MODEL as LICENSE26_3_, activation4_.LICENSE_TEXT as LICENSE27_3_, activation4_.SHIP_TO_EMAIL as SHIP_TO28_3_, activation4_.SHIP_TO_ADDRESS as SHIP_TO29_3_, licensedpr5_.ID as ID4_, licensedpr5_.DEFAULT_LICMODEL_ID as DEFAULT16_4_, licensedpr5_.LIC_GENERATOR as LIC_GEN17_4_, licensedpr5_.PACKAGE_NAME as PACKAGE18_4_, licensedpr5_.PACKAGE_VERSION_FORMAT as PACKAGE19_4_, licensedpr5_.PACKAGE_VERSION as PACKAGE20_4_, licensedpr5_.LAST_MODIFIED as LAST_MOD3_4_, licensedpr5_.CREATED_ON as CREATED_ON4_, licensedpr5_.DEFAULT_OBJECT as DEFAULT_5_4_, licensedpr5_.ORDERABLE_TYPE as ORDERABL2_4_, licensedpr5_.NAME as NAME4_, licensedpr5_.VERSION as VERSION4_, licensedpr5_.OPTION_NAME as OPTION_N8_4_, licensedpr5_.DESCRIPTION as DESCRIPT9_4_, licensedpr5_.IS_PERMANENT as IS_PERM10_4_, licensedpr5_.DURATION as DURATION4_, licensedpr5_.DURATION_UNITS as DURATIO12_4_, licensedpr5_.STATUS as STATUS4_, licensedpr5_.REVISION_NUMBER as REVISIO14_4_, licensedpr5_.EXTENDED_PROPERTIES as EXTENDE15_4_, licensemod6_.ID as ID5_, licensemod6_.LAST_MODIFIED as LAST_MOD2_5_, licensemod6_.CREATED_ON as CREATED_ON5_, licensemod6_.NAME as NAME5_, licensemod6_.DESCRIPTION as DESCRIPT5_5_, licensemod6_.STATUS as STATUS5_, licensemod6_.MODEL_TYPE as MODEL_TYPE5_, licensemod6_.DURATION as DURATION5_, licensemod6_.DURATION_UNITS as DURATION9_5_, licensemod6_.COUNTED as COUNTED5_, licensemod6_.LIC_GENERATOR as LIC_GEN11_5_, licensemod6_.LICENSE_TYPE as LICENSE12_5_, licensemod6_.PACKAGE_OPTION as PACKAGE13_5_, licensemod6_.DUP_GROUPING as DUP_GRO14_5_, licensemod6_.REHOSTS_LIFECYCLE_POLICY as REHOSTS15_5_, licensemod6_.RETURNS_LIFECYCLE_POLICY as RETURNS16_5_, licensemod6_.REPAIRS_LIFECYCLE_POLICY as REPAIRS17_5_, licensemod6_.ACTIVATIONS_LIFECYCLE_POLICY as ACTIVAT18_5_, licensemod6_.PROPERTIES as PROPERTIES5_ from flexnetpunit.OPS_ACTIVATION_INSTANCE certificat0_ left outer join flexnetpunit.PLT_EXTPROPSET extendedpr1_ on certificat0_.EXTENDED_PROPERTIES=extendedpr1_.ID left outer join flexnetpunit.OPS_ENTITLEMENT_ITEM entitlemen2_ on certificat0_.ENTITLEMENT_ITEM=entitlemen2_.ID left outer join flexnetpunit.OPS_ACTIVATABLE_ITEM entitlemen3_ on certificat0_.ENTITLEMENT_LINEITEM=entitlemen3_.ID left outer join flexnetpunit.OPS_ACTIVATION_INSTANCE activation4_ on certificat0_.PARENT_FULFILLMENT=activation4_.ID left outer join flexnetpunit.PROD_ORDERABLE licensedpr5_ on certificat0_.LICENSED_PRODUCT=licensedpr5_.ID left outer join flexnetpunit.PROD_LICENSE_MODEL licensemod6_ on certificat0_.LICENSE_MODEL=licensemod6_.ID where certificat0_.ID=100257



I get the following exception



Caused by: com.inet.ora.SQLException: java.lang.ArrayIndexOutOfBoundsException: 2040

at com.inet.ora.OraDriver.a(Unknown Source)

at com.inet.ora.u.executeQuery(Unknown Source)

at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)

at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:800)

at net.sf.hibernate.loader.Loader.doQuery(Loader.java:189)

at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 8:36 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
what is your jdbc driver and database ?
I think that problem is driver or database

regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 10:02 am 
Newbie

Joined: Mon Jul 26, 2004 2:52 pm
Posts: 11
The database I am using is: Oracle 9i
JDBC Driver: Inet 2.0.9 JDBC driver


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 11:42 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Do not see how this could be a Hibernate problem. Have you tried that same SQL directly through the inet JDBC driver? My guess is that you get the same failure.

You might want to check http://www.cc-group.de/products/jdbc/oracle/manual.asp since they seem to have quite a few closed issues regarding ArrayIndexOutOfBoundsExceptions; you may have found another ;)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 11:50 am 
Newbie

Joined: Mon Jul 26, 2004 2:52 pm
Posts: 11
Interesting enough, the SQL works fine with a simple JDBC app. We are guessing it could be due to some specific attributes set on the prepared statements that could be causing this problem. I guess we will have to debug Hibernate to really find the charecteristics of the statement to mimic this problem in a stand alone JDBC app.

We are convinced this is a JDBC driver issue. However we have not yet reproduced this problem using JDBC directly.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 12:02 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Pay for the DataDirect Oracle drivers and send the bill to Oracle. Or, bill them for the hours it takes you to debug their broken drivers. It's really interesting how many people just accept this sorry state of a product they have paid big $$$ for.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 27, 2005 6:25 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Christian,
They don't use oracle jdbc driver
sbathiniMVSN,
try oracle driver from 9i distribution and oracle 10g (you can download one from otn)

I try hibernate and oracle jdbc driver and haven't problems

regards


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 28, 2005 1:18 pm 
Newbie

Joined: Mon Jul 26, 2004 2:52 pm
Posts: 11
We figured the problem. We are using NVARCHAR columns. Once we changed the national character set to UTF-8, everything worked. The thing that puzzles me is the error was so misleading.


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