[Hibernate-JIRA] Created: (HHH-3851) object load with composite id
by sahasra (JIRA)
object load with composite id
-----------------------------
Key: HHH-3851
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3851
Project: Hibernate Core
Issue Type: Bug
Components: core
Environment: HIbernate Version : 3.3.1.GA
Database : Oracle 10g
The table column types are CHAR
Reporter: sahasra
Priority: Blocker
Having issues in loading, updating, deleting and querying with bind variable an entity with composite id. The table column types are CHAR
No row with the given identifier exists
but the row exists
I replace "?" by correct values, execute it in the SQL Plus and it works.
Code in the DAO class
public BoardDefinition getBoardDefinitionById(BoardDefinitionId anId)
throws HibernateException
{
BoardDefinition instance = (BoardDefinition)getHibernateTemplate().get(BoardDefinition.class, anId);
if (instance == null)
{
System.out.println("get successful, no instance found");
}
else
{
System.out.println("get successful, instance found");
}
return instance;
}
Generated SQL on running the test case
select boarddefin0_.STN as STN0_0_, boarddefin0_.BOARD_ID as BOARD2_0_0_, boarddefin0_.DESCRIPTION as DESCRIPT3_0_0_, boarddefin0_.BOARD_TYPE as BOARD4_0_0_, boarddefin0_.ACTV_FRA_RPT_FL as ACTV5_0_0_, boarddefin0_.DEACT_TRN_LINUP_FL as DEACT6_0_0_, boarddefin0_.TMP_MOVE_RESTR_EN as TMP7_0_0_, boarddefin0_.TMP_MOVE_RESTR_TR as TMP8_0_0_, boarddefin0_.TMP_MOVE_ALW_EN as TMP9_0_0_, boarddefin0_.TMP_MOVE_ALW_TR as TMP10_0_0_, boarddefin0_.AUTOSHT_CL_VAC_HRS as AUTOSHT11_0_0_, boarddefin0_.AUTOSHT_CL_VAC_MNS as AUTOSHT12_0_0_, boarddefin0_.AUTOSHT_CL_HRS as AUTOSHT13_0_0_, boarddefin0_.AUTOSHT_CL_MNS as AUTOSHT14_0_0_, boarddefin0_.COMMENTS as COMMENTS0_0_, boarddefin0_.WRK_RST_PROF_EN as WRK16_0_0_, boarddefin0_.WRK_RST_PROF_TR as WRK17_0_0_, boarddefin0_.SEN_MOVE_PROF_EN as SEN18_0_0_, boarddefin0_.SEN_MOVE_PROF_TR as SEN19_0_0_, boarddefin0_.MILES_PROF_EN as MILES20_0_0_, boarddefin0_.MILES_PROF_TR as MILES21_0_0_, boarddefin0_.STARTS_PROF_EN as STARTS22_0_0_, boarddefin0_.STARTS_PROF_TR as STARTS23_0_0_, boarddefin0_.BLE16_EN as BLE24_0_0_, boarddefin0_.FREE_DY_PROF_EN as FREE25_0_0_, boarddefin0_.FREE_DY_PROF_TR as FREE26_0_0_, boarddefin0_.SGL_DY_VAC_EN as SGL27_0_0_, boarddefin0_.SGL_DY_VAC_TR as SGL28_0_0_, boarddefin0_.LOF_RQST_ALW_EN_FL as LOF29_0_0_, boarddefin0_.LOF_RQST_ALW_TR_FL as LOF30_0_0_, boarddefin0_.SVC_TYP_CD as SVC31_0_0_, boarddefin0_.CRW_CONSIST_CD as CRW32_0_0_, boarddefin0_.UPD_TS as UPD33_0_0_, boarddefin0_.USER_ID as USER34_0_0_, boarddefin0_.SPRSS_BRD_ADVRT_FL as SPRSS35_0_0_, boarddefin0_.CRFT_TYP as CRFT36_0_0_, boarddefin0_.HDR_STN as HDR37_0_0_, boarddefin0_.HDR_BOARD as HDR38_0_0_, boarddefin0_.NBR_TRADES_MAX as NBR39_0_0_, boarddefin0_.TRADE_RESET_VALUE as TRADE40_0_0_, boarddefin0_.TRADE_RESET_TYPE as TRADE41_0_0_, boarddefin0_.TRADE_RESET_DT as TRADE42_0_0_, boarddefin0_.TRADE_ALLOWED_IND as TRADE43_0_0_, boarddefin0_.DISPLCE_CU_AWAY_FL as DISPLCE44_0_0_, boarddefin0_.NMS_ACTIVE_FL as NMS45_0_0_, boarddefin0_.SAME_BRD_MOVE_CD as SAME46_0_0_, boarddefin0_.TRADE_AGAINST_CD as TRADE47_0_0_, boarddefin0_.TMP_SEN_POS_PRF_EN as TMP48_0_0_, boarddefin0_.TMP_SEN_POS_PRF_TR as TMP49_0_0_, boarddefin0_.PERM_CUT_ALLW_FL as PERM50_0_0_, boarddefin0_.AUTO_PX_STN1 as AUTO51_0_0_, boarddefin0_.AUTO_PX_BRD1 as AUTO52_0_0_, boarddefin0_.AUTO_PX_STN2 as AUTO53_0_0_, boarddefin0_.AUTO_PX_BRD2 as AUTO54_0_0_, boarddefin0_.TRADE_TYPE_CD as TRADE55_0_0_, boarddefin0_.SPRS_BRD_ADVRT_DYS as SPRS56_0_0_, boarddefin0_.BUMP_PX_STN as BUMP57_0_0_, boarddefin0_.BUMP_PX_BOARD as BUMP58_0_0_, boarddefin0_.BUMP_OPEN_ASG_FL as BUMP59_0_0_, boarddefin0_.BUMP_MOST_JR_FL as BUMP60_0_0_, boarddefin0_.CUTOFF_STN as CUTOFF61_0_0_, boarddefin0_.CUTOFF_BOARD as CUTOFF62_0_0_, boarddefin0_.METRA_BOARD_FL as METRA63_0_0_, boarddefin0_.ADVRT_BID_FL as ADVRT64_0_0_, boarddefin0_.STAND_BID_FL as STAND65_0_0_, boarddefin0_.SEN_MOVE_FL as SEN66_0_0_, boarddefin0_.FORCED1_FB_FL as FORCED67_0_0_, boarddefin0_.FORCED2_FB_FL as FORCED68_0_0_, boarddefin0_.AUTO_DH_TU_FL as AUTO69_0_0_, boarddefin0_.RDE_BLGENBID_EN_FL as RDE70_0_0_, boarddefin0_.RDE_BLGENBID_TR_FL as RDE71_0_0_, boarddefin0_.SEN_MOVE_ALLOW_CD as SEN72_0_0_, boarddefin0_.DISP_ON_DUTY_FL as DISP73_0_0_, boarddefin0_.TRAINING_BOARD_FL as TRAINING74_0_0_ from BOARD_DEFINITION boarddefin0_ where boarddefin0_.STN=? and boarddefin0_.BOARD_ID=?
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated Apr 3, 2009 1:57:04 PM by Hibernate Tools 3.2.4.CR1 -->
<hibernate-mapping>
<class name="com.pstechnology.persistence.hibernate.BoardDefinition" table="BOARD_DEFINITION">
<composite-id name="id" class="com.pstechnology.persistence.hibernate.BoardDefinitionId">
<key-property name="stn" type="string">
<column name="STN" length="6" />
</key-property>
<key-property name="boardId" type="string">
<column name="BOARD_ID" length="4" />
</key-property>
</composite-id>
<property name="description" type="string">
<column name="DESCRIPTION" length="25" not-null="true" />
</property>
<property name="boardType" type="java.lang.Character">
<column name="BOARD_TYPE" length="1" />
</property>
<property name="actvFraRptFl" type="java.lang.Character">
<column name="ACTV_FRA_RPT_FL" length="1" />
</property>
</class>
</hibernate-mapping>
CREATE TABLE BOARD_DEFINITION
(
STN CHAR(6) NOT NULL,
BOARD_ID CHAR(4) NOT NULL,
DESCRIPTION VARCHAR2(25) NOT NULL,
BOARD_TYPE CHAR(1) NULL,
ACTV_FRA_RPT_FL CHAR(1) NULL,
constraint BOARD_DEFINITION_PK primary key (STN, BOARD_ID)
);
Code snippet of the generated POJOs
import java.math.BigDecimal;
import java.util.Date;
/**
* BoardDefinition generated by hbm2java
*/
public class BoardDefinition
implements java.io.Serializable
{
private BoardDefinitionId id;
private String description;
private Character boardType;
private Character actvFraRptFl;
-------
-------
-----
}
/**
* BoardDefinitionId generated by hbm2java
*/
public class BoardDefinitionId
implements java.io.Serializable
{
private String stn;
private String boardId;
public BoardDefinitionId()
{
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 11 months
[Hibernate-JIRA] Created: (HBX-1120) Incorrect ManyToMany Generation
by Henry Chan (JIRA)
Incorrect ManyToMany Generation
-------------------------------
Key: HBX-1120
URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-1120
Project: Hibernate Tools
Issue Type: Bug
Environment: MySQL v5.1
Hibernate Tools 3.2.4
Reporter: Henry Chan
When I run the reverse Engineering Tool to generate my classes, one of these classes does not have the correct manytomany annotation defined correctly:
In the example below, the I have User, User_Role and Role
The User classgets generated correctly:
User.java ...
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(name = "user_role", catalog = "exms", joinColumns = { @JoinColumn(name = "userID", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "roleID", nullable = false, updatable = false) })
public Set<Role> getRoles() {
return this.roles;
}
but Role.java class isn't correct:
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "roles")
public Set<User> getUsers() {
return this.users;
}
Where is the @JoinTable in Role.java?
DROP TABLE IF EXISTS `exms`.`Role` ;
CREATE TABLE IF NOT EXISTS `exms`.`Role` (
`roleID` INT NOT NULL AUTO_INCREMENT ,
`roleName` VARCHAR(45) NOT NULL ,
PRIMARY KEY (`roleID`) )
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `exms`.`Login`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `exms`.`Login` ;
CREATE TABLE IF NOT EXISTS `exms`.`Login` (
`loginID` INT NOT NULL AUTO_INCREMENT ,
`userID` INT NULL ,
`timeStamp` DATETIME NULL ,
`failedLogins` INT NULL ,
PRIMARY KEY (`loginID`) ,
INDEX `fk_Login_User` (`userID` ASC) ,
CONSTRAINT `fk_Login_User`
FOREIGN KEY (`userID` )
REFERENCES `exms`.`User` (`userID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `exms`.`User_Role`
-- -----------------------------------------------------
DROP TABLE IF EXISTS `exms`.`User_Role` ;
CREATE TABLE IF NOT EXISTS `exms`.`User_Role` (
`userID` INT NOT NULL ,
`roleID` INT NOT NULL ,
INDEX `fk_User_Role_User` (`userID` ASC) ,
INDEX `fk_User_Role_Role` (`roleID` ASC) ,
PRIMARY KEY (`userID`, `roleID`) ,
CONSTRAINT `fk_User_Role_User`
FOREIGN KEY (`userID` )
REFERENCES `exms`.`User` (`userID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_User_Role_Role`
FOREIGN KEY (`roleID` )
REFERENCES `exms`.`Role` (`roleID` )
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 11 months
[Hibernate-JIRA] Created: (EJB-315) unnecessary update when merge managed entity
by Jifeng Liu (JIRA)
unnecessary update when merge managed entity
--------------------------------------------
Key: EJB-315
URL: http://opensource.atlassian.com/projects/hibernate/browse/EJB-315
Project: Hibernate Entity Manager
Issue Type: Bug
Affects Versions: 3.3.1.GA
Environment: Hibernate Core 3.2.5.ga
Hibernate Annotations 3.3.0 GA
hsqldb
Reporter: Jifeng Liu
Attachments: testcase.zip
If the entity in em.merge(entity) is managed entity, the merge operation should be ignored. However it issues a update statement in the test case even if there is no changes.
In the test case, Parent entity has a list of Image entity with Many-To-Many relation. em.merge() somehow marks the list as dirty, which causes the update statement.
The following is trace log of the test case.
07.20,23 INFO ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
07.20,601 DEBUG SQL - /* insert test.Parent */ insert into Parent (updateDateTime, Parent_No) values (?, ?)
07.20,617 DEBUG SQL - /* insert test.Image */ insert into Image (name, imageNo) values (?, ?)
07.20,617 DEBUG SQL - /* insert collection row test.Parent.images */ insert into Parent_Image (Parent_Parent_No, images_
imageNo) values (?, ?)
07.20,632 DEBUG SQL - /* load test.Parent */ select parent0_.Parent_No as Parent1_0_0_, parent0_.updateDateTime as updat
eDa2_0_0_ from Parent parent0_ where parent0_.Parent_No=?
07.20,648 DEBUG SQL - /* load collection test.Parent.images */ select images0_.Parent_Parent_No as Parent1_1_, images0_.
images_imageNo as images2_1_, image1_.imageNo as imageNo1_0_, image1_.name as name1_0_ from Parent_Image images0_ left o
uter join Image image1_ on images0_.images_imageNo=image1_.imageNo where images0_.Parent_Parent_No=?
07.20,679 DEBUG SQL - /* update test.Parent */ update Parent set updateDateTime=? where Parent_No=? and updateDateTime=?
07.20,679 DEBUG SQL - /* delete collection test.Parent.images */ delete from Parent_Image where Parent_Parent_No=?
07.20,679 DEBUG SQL - /* insert collection row test.Parent.images */ insert into Parent_Image (Parent_Parent_No, images_
imageNo) values (?, ?)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 11 months
[Hibernate-JIRA] Created: (HHH-2830) Insert error ignored when using sybase generated identity column
by Martin van Dijken (JIRA)
Insert error ignored when using sybase generated identity column
----------------------------------------------------------------
Key: HHH-2830
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2830
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.2
Environment: Hibernate 3.2.2, Sybase 12.5.3
Reporter: Martin van Dijken
All our tables have a single database generated identity column. This column is specified in Sybase as:
objectId numeric(12) identity
A little while ago, Hibernate started throwing NonUniqueObjectExceptions upon insert of a certain object. It turns out, the insert statement could not possibly succeed as the value of one of the columns was larger than the database column. The error is however ignored because Hibernate generates a query:
insert into objectTable (objectName, objectNumericErrorField) values (?,?) select @@ identity
The value of objectNumericErrorField was larger than the database column allows. The insert statement would therefore fail. The select @@identity however would succeed, only because no new row was inserted it would return the previous ID.
Hibernate then assumes the entire query worked fine and would assign the already assigned id to a different object. It would then check whether or not the id was already in use and throw a NonUniqueObjectException
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 11 months
[Hibernate-JIRA] Created: (HHH-2656) Using EntityMode.DOM4J results in an exception when mapping more than one collection to the root node (node=".")
by Andries Schutte (JIRA)
Using EntityMode.DOM4J results in an exception when mapping more than one collection to the root node (node=".")
----------------------------------------------------------------------------------------------------------------
Key: HHH-2656
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2656
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.2.4.sp1
Environment: Hibernate 3.2.4 SP1, tested with MySQL 5.0.
Reporter: Andries Schutte
When mapping multiple collections to the root node, an exception results (mapping and exception stack trace is shown below). This works fine if only one collection is mapped to the root node, or if one explicitly specifies unique names for each collection parent node. We are unfortunately restricted by having to use customer-defined XSDs, so this is a show-stopper for us.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class entity-name="ProcessImpl" table="PROCESSES" node="Process">
<id name="sysID" column="PROCESS_ID" node="sysID" type="string"/>
<property name="version" column="PROCESS_VERSION" node="version" type="string"/>
<property name="processType" column="PROCESS_TYPE" node="processType" type="string"/>
<property name="status" column="PROCESS_STATE" node="status" type="string"/>
<property name="createDate" column="PROCESS_CREATE_DATE" node="createDate" type="timestamp"/>
<property name="creator" column="PROCESS_CREATOR" node="creator" type="string"/>
<property name="transactionNumber" column="PROCESS_TX_NUMBER" node="transactionNumber" type="long"/>
<property name="modifiedDate" column="PROCESS_MOD_DATE" node="modifiedDate" type="timestamp"/>
<property name="modifier" column="PROCESS_MODIFIER" node="modifier" type="string"/>
<property name="title" column="PROCESS_TITLE" node="title" type="string"/>
<property name="timer" column="PROCESS_TIMER" node="timer" type="string"/>
<property name="currentCSTime" column="PROCESS_CS_TIME" node="currentCSTime" type="timestamp"/>
<bag name="requiredActivities"
table="REQ_ACTIVITIES" node = "." embed-xml="true" lazy="false" cascade="all">
<key column="PROCESS_ID" not-null="true"/>
<element column="REQ_ACTIVITY" type="text" node="requiredActivity"/>
</bag>
<bag name="retractedGuidelines"
table="RET_GUIDELINES" node = "." embed-xml="true" lazy="false" cascade="all">
<key column="PROCESS_ID" not-null="true"/>
<element column="RET_GUIDELINE" type="text" node="retractedGuideline"/>
</bag>
<set name="suspendedGuidelines"
node = "." embed-xml="true" lazy="false" cascade="all">
<key column="PROCESS_ID" not-null="true"/>
<one-to-many entity-name="SuspendedGuidelineImpl"
embed-xml="true" node="suspendedGuideline"/>
</set>
</class>
</hibernate-mapping>
Exception stack trace:
[6/6/07 22:11:41:246 GMT] 00000012 SystemErr R org.hibernate.HibernateException: Found shared references to a collection: ProcessImpl.retractedGuidelines
at org.hibernate.engine.Collections.processReachableCollection(Collections.java:163)
at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:101)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:61)
at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:55)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:131)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at com.resonant.persistence.ExternalDataMgrHibernateDom4jImpl.persistHibernateEntity(ExternalDataMgrHibernateDom4jImpl.java:194)
at com.resonant.persistence.ExternalDataMgrHibernateDom4jImpl.store(ExternalDataMgrHibernateDom4jImpl.java:172)
at com.resonant.persistence.PersistenceHibernateDom4jImpl.storeObject(PersistenceHibernateDom4jImpl.java:215)
at com.resonant.persistence.ejb.PersistenceLocalBean.storeObject(PersistenceLocalBean.java:192)
at com.resonant.persistence.ejb.EJSLocalStatelessPersistenceLocalEJB_68e55914.storeObject(EJSLocalStatelessPersistenceLocalEJB_68e55914.java:1179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.springframework.ejb.access.LocalSlsbInvokerInterceptor.invoke(LocalSlsbInvokerInterceptor.java:65)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy2.storeObject(Unknown Source)
at com.resonant.hub.processmanager.ProcessHubImpl.startProcess(ProcessHubImpl.java:179)
at com.resonant.hub.processmanager.ejb.ProcessHubBean.startProcess(ProcessHubBean.java:138)
at com.resonant.hub.processmanager.ejb.EJSRemoteStatelessProcessHubEJB_f45832db.startProcess(EJSRemoteStatelessProcessHubEJB_f45832db.java:208)
at com.resonant.hub.processmanager.ejb._EJSRemoteStatelessProcessHubEJB_f45832db_Tie.startProcess(_EJSRemoteStatelessProcessHubEJB_f45832db_Tie.java:261)
at com.resonant.hub.processmanager.ejb._EJSRemoteStatelessProcessHubEJB_f45832db_Tie._invoke(_EJSRemoteStatelessProcessHubEJB_f45832db_Tie.java:122)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:613)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:466)
at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1552)
at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2673)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2551)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1510)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 11 months
[Hibernate-JIRA] Created: (HHH-2140) SQLQueryParser throws ArrayIndexOutOfBoundsException: -1 for SQL query with join mapped as set of string elements
by Artur Jonak (JIRA)
SQLQueryParser throws ArrayIndexOutOfBoundsException: -1 for SQL query with join mapped as set of string elements
-----------------------------------------------------------------------------------------------------------------
Key: HHH-2140
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2140
Project: Hibernate3
Type: Bug
Components: query-sql
Versions: 3.1.3
Reporter: Artur Jonak
I have the following mapping:
<class name="GCPSimpleDocumentImpl" table="GCP_Node" mutable="false">
<id name="DocumentId" />
...
<set name="ApplicationAreas" table="GCP_ApplicationArea" cascade="none" order-by="Name" sort="natural" mutable="false">
<key column="DocumentId"/>
<element type="string" column="Name"/>
</set>
</class>
and I try to run an SQL query:
List result = session.createSQLQuery(
"select distinct {node.*}, {areas.*} from GCP_Node node join GCP_ApplicationArea areas on node.DocumentId=areas.DocumentId " +
"where areas.Name like 'BS - CF%'")
.addEntity("node", GCPSimpleDocumentImpl.class)
.addJoin("areas", "node.ApplicationAreas")
.list();
Unfortunately I get the following exception:
java.lang.ArrayIndexOutOfBoundsException: -1
at org.hibernate.loader.custom.SQLQueryParser.substituteBrackets(SQLQueryParser.java:133)
at org.hibernate.loader.custom.SQLQueryParser.process(SQLQueryParser.java:85)
at org.hibernate.loader.custom.SQLCustomQuery.<init>(SQLCustomQuery.java:157)
at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:20)
at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:113)
at org.hibernate.impl.AbstractSessionImpl.getNativeSQLQueryPlan(AbstractSessionImpl.java:137)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)
...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
14 years, 11 months