-->
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.  [ 3 posts ] 
Author Message
 Post subject: Facing issue with Batch-updates using HQL
PostPosted: Sun May 14, 2006 2:05 pm 
Newbie

Joined: Tue Mar 07, 2006 7:54 am
Posts: 2
Location: Kochi, India
Hibernate version:
3.1.3


Name and version of the database you are using:
MySQL 5.0.18


SQL that I am trying to model in HQL
update hr_emp_attendance_temp ATN
set ATN.duty_roster_id = (select DR.id from hr_duty_roster DR
where DR.employee_id = ATN.employee_id
and DR.planned_shift_date = ATN.punch_in_date
);

Code between sessionFactory.openSession() and session.close():
String updateRstrStr = "update HrEmpAttendanceTemp ATN" +
" set ATN.dutyRosterId = (select DR.id from HrDutyRoster DR" +
" where DR.hrEmployees.id = ATN.employeeId" +
" and DR.plannedShiftDate = ATN.punchInDate)"
;
Query hqlUpdRstrQry = session.createQuery(updateRstrStr);
int rowsUpdRstr = hqlUpdRstrQry.executeUpdate();
log.info(rowsUpdRstr + " rows updated for " + hqlUpdRstrQry.getQueryString());


The generated SQL (show_sql=true):
update
hr.hr_emp_attendance_temp
set
duty_roster_id=(select
hrdutyrost1_.id
from
hr.hr_duty_roster hrdutyrost1_
where
hrdutyrost1_.employee_id=hrempatten0_.employee_id
and hrdutyrost1_.planned_shift_date=hrempatten0_.punch_in_date)


Full stack trace of any exception that occurs:
Hibernate:
update
hr.hr_emp_attendance_temp
set
duty_roster_id=(select
hrdutyrost1_.id
from
hr.hr_duty_roster hrdutyrost1_
where
hrdutyrost1_.employee_id=hrempatten0_.employee_id
and hrdutyrost1_.planned_shift_date=hrempatten0_.punch_in_date)
24672 [HttpProcessor[8080][4]] WARN util.JDBCExceptionReporter - SQL Error: 1054, SQLState: 42S22
24672 [HttpProcessor[8080][4]] ERROR util.JDBCExceptionReporter - Unknown column 'hrempatten0_.employee_id' in 'where clause'
org.hibernate.exception.SQLGrammarException: could not execute update query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:84)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:334)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:209)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1126)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
at com.amritatech.hr.helper.HrAttendanceEJBHelper.mergePortedDay(HrAttendanceEJBHelper.java:359)


Debug level Hibernate log excerpt:
57735 [HttpProcessor[8080][0]] DEBUG query.QueryPlanCache - unable to locate HQL query plan in cache; generating (update HrEmpAttendanceTemp ATN set ATN.dutyRosterId = (select DR.id from HrDutyRoster DR where DR.hrEmployees.id = ATN.employeeId and DR.plannedShiftDate = ATN.punchInDate))
57735 [HttpProcessor[8080][0]] DEBUG ast.QueryTranslatorImpl - parse() - HQL: update com.amritatech.hr.hibernate.HrEmpAttendanceTemp ATN set ATN.dutyRosterId = (select DR.id from com.amritatech.hr.hibernate.HrDutyRoster DR where DR.hrEmployees.id = ATN.employeeId and DR.plannedShiftDate = ATN.punchInDate)
57735 [HttpProcessor[8080][0]] DEBUG ast.AST - --- HQL AST ---
\-[UPDATE] 'update'
+-[FROM] 'FROM'
| \-[RANGE] 'RANGE'
| +-[DOT] '.'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[DOT] '.'
| | | | | +-[IDENT] 'com'
| | | | | \-[IDENT] 'amritatech'
| | | | \-[IDENT] 'hr'
| | | \-[IDENT] 'hibernate'
| | \-[IDENT] 'HrEmpAttendanceTemp'
| \-[ALIAS] 'ATN'
\-[SET] 'set'
\-[EQ] '='
+-[DOT] '.'
| +-[IDENT] 'ATN'
| \-[IDENT] 'dutyRosterId'
\-[QUERY] 'query'
+-[SELECT_FROM] 'SELECT_FROM'
| +-[FROM] 'from'
| | \-[RANGE] 'RANGE'
| | +-[DOT] '.'
| | | +-[DOT] '.'
| | | | +-[DOT] '.'
| | | | | +-[DOT] '.'
| | | | | | +-[IDENT] 'com'
| | | | | | \-[IDENT] 'amritatech'
| | | | | \-[IDENT] 'hr'
| | | | \-[IDENT] 'hibernate'
| | | \-[IDENT] 'HrDutyRoster'
| | \-[ALIAS] 'DR'
| \-[SELECT] 'select'
| \-[DOT] '.'
| +-[IDENT] 'DR'
| \-[IDENT] 'id'
\-[WHERE] 'where'
\-[AND] 'and'
+-[EQ] '='
| +-[DOT] '.'
| | +-[DOT] '.'
| | | +-[IDENT] 'DR'
| | | \-[IDENT] 'hrEmployees'
| | \-[IDENT] 'id'
| \-[DOT] '.'
| +-[IDENT] 'ATN'
| \-[IDENT] 'employeeId'
\-[EQ] '='
+-[DOT] '.'
| +-[IDENT] 'DR'
| \-[IDENT] 'plannedShiftDate'
\-[DOT] '.'
+-[IDENT] 'ATN'
\-[IDENT] 'punchInDate'

57735 [HttpProcessor[8080][0]] DEBUG ast.ErrorCounter - throwQueryException() : no errors
57735 [HttpProcessor[8080][0]] DEBUG antlr.HqlSqlBaseWalker - update << begin [level=1, statement=update]
57735 [HttpProcessor[8080][0]] DEBUG tree.FromElement - FromClause{level=1} : com.amritatech.hr.hibernate.HrEmpAttendanceTemp (ATN) -> hrempatten0_
57735 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : ATN -> id
57735 [HttpProcessor[8080][0]] DEBUG tree.DotNode - getDataType() : dutyRosterId -> org.hibernate.type.IntegerType@b458fd
57735 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : ATN.dutyRosterId -> duty_roster_id
57735 [HttpProcessor[8080][0]] DEBUG antlr.HqlSqlBaseWalker - select << begin [level=2, statement=update]
57750 [HttpProcessor[8080][0]] DEBUG tree.FromElement - FromClause{level=2} : com.amritatech.hr.hibernate.HrDutyRoster (DR) -> hrdutyrost1_
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : DR -> id
57750 [HttpProcessor[8080][0]] DEBUG tree.DotNode - getDataType() : id -> org.hibernate.type.IntegerType@b458fd
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : DR.id -> hrdutyrost1_.id
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : DR -> id
57750 [HttpProcessor[8080][0]] DEBUG tree.DotNode - getDataType() : hrEmployees -> org.hibernate.type.ManyToOneType(com.amritatech.hr.hibernate.HrEmployees)
57750 [HttpProcessor[8080][0]] DEBUG tree.DotNode - dereferenceShortcut() : property id in com.amritatech.hr.hibernate.HrDutyRoster does not require a join.
57750 [HttpProcessor[8080][0]] DEBUG tree.DotNode - Unresolved property path is now 'hrEmployees.id'
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : DR.hrEmployees -> hrdutyrost1_.employee_id
57750 [HttpProcessor[8080][0]] DEBUG tree.DotNode - getDataType() : hrEmployees.id -> org.hibernate.type.IntegerType@b458fd
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : DR.hrEmployees.id -> hrdutyrost1_.employee_id
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : ATN -> id
57750 [HttpProcessor[8080][0]] DEBUG tree.DotNode - getDataType() : employeeId -> org.hibernate.type.IntegerType@b458fd
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : ATN.employeeId -> hrempatten0_.employee_id
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : DR -> id
57750 [HttpProcessor[8080][0]] DEBUG tree.DotNode - getDataType() : plannedShiftDate -> org.hibernate.type.TimestampType@1cc946b
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : DR.plannedShiftDate -> hrdutyrost1_.planned_shift_date
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : ATN -> id
57750 [HttpProcessor[8080][0]] DEBUG tree.DotNode - getDataType() : punchInDate -> org.hibernate.type.TimestampType@1cc946b
57750 [HttpProcessor[8080][0]] DEBUG tree.FromReferenceNode - Resolved : ATN.punchInDate -> hrempatten0_.punch_in_date
57750 [HttpProcessor[8080][0]] DEBUG antlr.HqlSqlBaseWalker - select : finishing up [level=2, statement=update]
57750 [HttpProcessor[8080][0]] DEBUG ast.HqlSqlWalker - processQuery() : ( SELECT ( {select clause} ( hrdutyrost1_.id id id ) ) ( FromClause{level=2} hr.hr_duty_roster hrdutyrost1_ ) ( where ( and ( = ( hrdutyrost1_.employee_id ( hrdutyrost1_.employee_id id hrEmployees ) id ) ( hrempatten0_.employee_id id employeeId ) ) ( = ( hrdutyrost1_.planned_shift_date id plannedShiftDate ) ( hrempatten0_.punch_in_date id punchInDate ) ) ) ) )
57750 [HttpProcessor[8080][0]] DEBUG util.JoinProcessor - Using FROM fragment [hr.hr_duty_roster hrdutyrost1_]
57750 [HttpProcessor[8080][0]] DEBUG antlr.HqlSqlBaseWalker - select >> end [level=2, statement=update]
57750 [HttpProcessor[8080][0]] DEBUG antlr.HqlSqlBaseWalker - update : finishing up [level=1, statement=update]
57750 [HttpProcessor[8080][0]] DEBUG antlr.HqlSqlBaseWalker - update >> end [level=1, statement=update]
57750 [HttpProcessor[8080][0]] DEBUG ast.AST - --- SQL AST ---
\-[UPDATE] UpdateStatement: 'update' querySpaces (hr.hr_duty_roster,hr.hr_emp_attendance_temp)
+-[FROM] FromClause: 'FROM' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[ATN], fromElementByTableAlias=[hrempatten0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
| \-[FROM_FRAGMENT] FromElement: 'hr.hr_emp_attendance_temp' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=ATN,role=null,tableName=hr.hr_emp_attendance_temp,tableAlias=hrempatten0_,origin=null,colums={,className=com.amritatech.hr.hibernate.HrEmpAttendanceTemp}}
\-[SET] SqlNode: 'set'
\-[EQ] BinaryLogicOperatorNode: '='
+-[DOT] DotNode: 'duty_roster_id' {propertyName=dutyRosterId,dereferenceType=4,propertyPath=dutyRosterId,path=ATN.dutyRosterId,tableAlias=hrempatten0_,className=com.amritatech.hr.hibernate.HrEmpAttendanceTemp,classAlias=ATN}
| +-[ALIAS_REF] IdentNode: 'id' {alias=ATN, className=com.amritatech.hr.hibernate.HrEmpAttendanceTemp, tableAlias=hrempatten0_}
| \-[IDENT] IdentNode: 'dutyRosterId' {originalText=dutyRosterId}
\-[SELECT] QueryNode: 'SELECT' querySpaces (hr.hr_duty_roster,hr.hr_emp_attendance_temp)
+-[SELECT_CLAUSE] SelectClause: '{select clause}'
| \-[DOT] DotNode: 'hrdutyrost1_.id' {propertyName=id,dereferenceType=4,propertyPath=id,path=DR.id,tableAlias=hrdutyrost1_,className=com.amritatech.hr.hibernate.HrDutyRoster,classAlias=DR}
| +-[ALIAS_REF] IdentNode: 'id' {alias=DR, className=com.amritatech.hr.hibernate.HrDutyRoster, tableAlias=hrdutyrost1_}
| \-[IDENT] IdentNode: 'id' {originalText=id}
+-[FROM] FromClause: 'from' FromClause{level=2, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[DR], fromElementByTableAlias=[hrdutyrost1_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
| \-[FROM_FRAGMENT] FromElement: 'hr.hr_duty_roster hrdutyrost1_' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=DR,role=null,tableName=hr.hr_duty_roster,tableAlias=hrdutyrost1_,origin=null,colums={,className=com.amritatech.hr.hibernate.HrDutyRoster}}
\-[WHERE] SqlNode: 'where'
\-[AND] SqlNode: 'and'
+-[EQ] BinaryLogicOperatorNode: '='
| +-[DOT] DotNode: 'hrdutyrost1_.employee_id' {propertyName=id,dereferenceType=4,propertyPath=hrEmployees.id,path=DR.hrEmployees.id,tableAlias=hrdutyrost1_,className=com.amritatech.hr.hibernate.HrDutyRoster,classAlias=DR}
| | +-[DOT] DotNode: 'hrdutyrost1_.employee_id' {propertyName=id,dereferenceType=ROOT_LEVEL,propertyPath=hrEmployees.id,path=DR.hrEmployees,tableAlias=hrdutyrost1_,className=com.amritatech.hr.hibernate.HrDutyRoster,classAlias=DR}
| | | +-[ALIAS_REF] IdentNode: 'id' {alias=DR, className=com.amritatech.hr.hibernate.HrDutyRoster, tableAlias=hrdutyrost1_}
| | | \-[IDENT] IdentNode: 'hrEmployees' {originalText=hrEmployees}
| | \-[IDENT] IdentNode: 'id' {originalText=id}
| \-[DOT] DotNode: 'hrempatten0_.employee_id' {propertyName=employeeId,dereferenceType=4,propertyPath=employeeId,path=ATN.employeeId,tableAlias=hrempatten0_,className=com.amritatech.hr.hibernate.HrEmpAttendanceTemp,classAlias=ATN}
| +-[ALIAS_REF] IdentNode: 'id' {alias=ATN, className=com.amritatech.hr.hibernate.HrEmpAttendanceTemp, tableAlias=hrempatten0_}
| \-[IDENT] IdentNode: 'employeeId' {originalText=employeeId}
\-[EQ] BinaryLogicOperatorNode: '='
+-[DOT] DotNode: 'hrdutyrost1_.planned_shift_date' {propertyName=plannedShiftDate,dereferenceType=4,propertyPath=plannedShiftDate,path=DR.plannedShiftDate,tableAlias=hrdutyrost1_,className=com.amritatech.hr.hibernate.HrDutyRoster,classAlias=DR}
| +-[ALIAS_REF] IdentNode: 'id' {alias=DR, className=com.amritatech.hr.hibernate.HrDutyRoster, tableAlias=hrdutyrost1_}
| \-[IDENT] IdentNode: 'plannedShiftDate' {originalText=plannedShiftDate}
\-[DOT] DotNode: 'hrempatten0_.punch_in_date' {propertyName=punchInDate,dereferenceType=4,propertyPath=punchInDate,path=ATN.punchInDate,tableAlias=hrempatten0_,className=com.amritatech.hr.hibernate.HrEmpAttendanceTemp,classAlias=ATN}
+-[ALIAS_REF] IdentNode: 'id' {alias=ATN, className=com.amritatech.hr.hibernate.HrEmpAttendanceTemp, tableAlias=hrempatten0_}
\-[IDENT] IdentNode: 'punchInDate' {originalText=punchInDate}

57750 [HttpProcessor[8080][0]] DEBUG ast.ErrorCounter - throwQueryException() : no errors
57750 [HttpProcessor[8080][0]] DEBUG ast.ErrorCounter - throwQueryException() : no errors
57750 [HttpProcessor[8080][0]] DEBUG query.HQLQueryPlan - HQL param location recognition took 0 mills (update HrEmpAttendanceTemp ATN set ATN.dutyRosterId = (select DR.id from HrDutyRoster DR where DR.hrEmployees.id = ATN.employeeId and DR.plannedShiftDate = ATN.punchInDate))
57750 [HttpProcessor[8080][0]] DEBUG query.QueryPlanCache - located HQL query plan in cache (update HrEmpAttendanceTemp ATN set ATN.dutyRosterId = (select DR.id from HrDutyRoster DR where DR.hrEmployees.id = ATN.employeeId and DR.plannedShiftDate = ATN.punchInDate))
57750 [HttpProcessor[8080][0]] DEBUG def.AbstractFlushingEventListener - flushing session
57750 [HttpProcessor[8080][0]] DEBUG def.AbstractFlushingEventListener - processing flush-time cascades
57750 [HttpProcessor[8080][0]] DEBUG def.AbstractFlushingEventListener - dirty checking collections
57750 [HttpProcessor[8080][0]] DEBUG def.AbstractFlushingEventListener - Flushing entities and processing referenced collections
57750 [HttpProcessor[8080][0]] DEBUG engine.Collections - Collection found: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceOuts#1], was: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceOuts#1] (uninitialized)
57750 [HttpProcessor[8080][0]] DEBUG engine.Collections - Collection found: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceIns#1], was: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceIns#1] (uninitialized)
57750 [HttpProcessor[8080][0]] DEBUG engine.Collections - Collection found: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceOuts#2], was: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceOuts#2] (uninitialized)
57750 [HttpProcessor[8080][0]] DEBUG engine.Collections - Collection found: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceIns#2], was: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceIns#2] (uninitialized)
57766 [HttpProcessor[8080][0]] DEBUG engine.Collections - Collection found: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceOuts#3], was: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceOuts#3] (uninitialized)
57766 [HttpProcessor[8080][0]] DEBUG engine.Collections - Collection found: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceIns#3], was: [com.amritatech.hr.hibernate.HrAttendancePorting.hrEmpAttendanceIns#3] (uninitialized)
57766 [HttpProcessor[8080][0]] DEBUG def.AbstractFlushingEventListener - Processing unreferenced collections
57766 [HttpProcessor[8080][0]] DEBUG def.AbstractFlushingEventListener - Scheduling collection removes/(re)creates/updates
57766 [HttpProcessor[8080][0]] DEBUG def.AbstractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0 deletions to 3 objects
57766 [HttpProcessor[8080][0]] DEBUG def.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 6 collections
57766 [HttpProcessor[8080][0]] DEBUG pretty.Printer - listing entities:
57766 [HttpProcessor[8080][0]] DEBUG pretty.Printer - com.amritatech.hr.hibernate.HrAttendancePorting{extension17=null, siteId=null, extension07=null, extension20=null, extension01=null, extension14=null, extension06=null, id=3, extension19=null, edition=0, mergedDate=null, extension10=null, extension04=null, lastModifiedBy=null, lastModifiedDateTime=null, extension12=null, extension13=null, extension03=null, punchedDate=2006-04-05 00:00:00, extension18=null, extension02=null, portedDate=2006-05-14 18:51:17, extension09=null, extension15=null, extension05=null, portedById=null, extension11=null, hrEmpAttendanceIns=<uninitialized>, mergedById=null, hrEmpAttendanceOuts=<uninitialized>, extension08=null, extension16=null}
57766 [HttpProcessor[8080][0]] DEBUG pretty.Printer - com.amritatech.hr.hibernate.HrAttendancePorting{extension17=null, siteId=null, extension07=null, extension20=null, extension01=null, extension14=null, extension06=null, id=2, extension19=null, edition=0, mergedDate=null, extension10=null, extension04=null, lastModifiedBy=null, lastModifiedDateTime=null, extension12=null, extension13=null, extension03=null, punchedDate=2006-04-04 00:00:00, extension18=null, extension02=null, portedDate=2006-05-14 18:51:12, extension09=null, extension15=null, extension05=null, portedById=null, extension11=null, hrEmpAttendanceIns=<uninitialized>, mergedById=null, hrEmpAttendanceOuts=<uninitialized>, extension08=null, extension16=null}
57766 [HttpProcessor[8080][0]] DEBUG pretty.Printer - com.amritatech.hr.hibernate.HrAttendancePorting{extension17=null, siteId=null, extension07=null, extension20=null, extension01=null, extension14=null, extension06=null, id=1, extension19=null, edition=0, mergedDate=null, extension10=null, extension04=null, lastModifiedBy=null, lastModifiedDateTime=null, extension12=null, extension13=null, extension03=null, punchedDate=2006-04-03 00:00:00, extension18=null, extension02=null, portedDate=2006-05-14 18:51:06, extension09=null, extension15=null, extension05=null, portedById=null, extension11=null, hrEmpAttendanceIns=<uninitialized>, mergedById=null, hrEmpAttendanceOuts=<uninitialized>, extension08=null, extension16=null}
57766 [HttpProcessor[8080][0]] DEBUG def.DefaultAutoFlushEventListener - Dont need to execute flush
57766 [HttpProcessor[8080][0]] DEBUG query.HQLQueryPlan - executeUpdate: update HrEmpAttendanceTemp ATN set ATN.dutyRosterId = (select DR.id from HrDutyRoster DR where DR.hrEmployees.id = ATN.employeeId and DR.plannedShiftDate = ATN.punchInDate)
57766 [HttpProcessor[8080][0]] DEBUG engine.QueryParameters - named parameters: {}
57766 [HttpProcessor[8080][0]] DEBUG jdbc.AbstractBatcher - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
57766 [HttpProcessor[8080][0]] DEBUG jdbc.ConnectionManager - opening JDBC connection
57766 [HttpProcessor[8080][0]] DEBUG hibernate.SQL -
update
hr.hr_emp_attendance_temp
set
duty_roster_id=(select
hrdutyrost1_.id
from
hr.hr_duty_roster hrdutyrost1_
where
hrdutyrost1_.employee_id=hrempatten0_.employee_id
and hrdutyrost1_.planned_shift_date=hrempatten0_.punch_in_date)
57766 [HttpProcessor[8080][0]] DEBUG jdbc.AbstractBatcher - preparing statement
Hibernate:
update
hr.hr_emp_attendance_temp
set
duty_roster_id=(select
hrdutyrost1_.id
from
hr.hr_duty_roster hrdutyrost1_
where
hrdutyrost1_.employee_id=hrempatten0_.employee_id
and hrdutyrost1_.planned_shift_date=hrempatten0_.punch_in_date)
57891 [HttpProcessor[8080][0]] DEBUG jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
57891 [HttpProcessor[8080][0]] DEBUG jdbc.AbstractBatcher - closing statement
57891 [HttpProcessor[8080][0]] DEBUG jdbc.ConnectionManager - aggressively releasing JDBC connection
57891 [HttpProcessor[8080][0]] DEBUG jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
57891 [HttpProcessor[8080][0]] DEBUG util.JDBCExceptionReporter - could not execute update query [update hr.hr_emp_attendance_temp set duty_roster_id=(select hrdutyrost1_.id from hr.hr_duty_roster hrdutyrost1_ where hrdutyrost1_.employee_id=hrempatten0_.employee_id and hrdutyrost1_.planned_shift_date=hrempatten0_.punch_in_date)]
java.sql.SQLException: Unknown column 'hrempatten0_.employee_id' in 'where clause'
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1166)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1082)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1067)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:101)
at org.hibernate.hql.ast.exec.BasicExecutor.execute(BasicExecutor.java:75)
at org.hibernate.hql.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:334)
at org.hibernate.engine.query.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:209)
at org.hibernate.impl.SessionImpl.executeUpdate(SessionImpl.java:1126)
at org.hibernate.impl.QueryImpl.executeUpdate(QueryImpl.java:94)
at com.amritatech.hr.helper.HrAttendanceEJBHelper.mergePortedDay(HrAttendanceEJBHelper.java:359)


Top
 Profile  
 
 Post subject:
PostPosted: Sun May 14, 2006 2:08 pm 
Newbie

Joined: Tue Mar 07, 2006 7:54 am
Posts: 2
Location: Kochi, India
Hi,
The issue I am facing is that the alias I listed in HQL is absent in the SQL generated by Hibernate. Is this a bug? Or is it a feature (in sec 13.4 of manual it is mentioned that "No Section 14.4, "Forms of join syntax" (either implicit or explicit) can be specified in a bulk HQL query ...")?

Regards,
Rayudu


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 24, 2006 2:41 am 
Regular
Regular

Joined: Wed Mar 08, 2006 2:07 am
Posts: 50
Location: Bangalore
try removing alias!


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