[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-759) problem for mixxing setmaxresults and setlockmode
Anton Vodonosov (JIRA)
noreply at atlassian.com
Fri Apr 27 13:55:04 EDT 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_26823 ]
Anton Vodonosov commented on HHH-759:
-------------------------------------
Take a look at the SQL generated by such queries:
select * from ( select this_.ID as ID17_0_, <other columns> from avodonosov.MIGRATION_JOBS this_ ) where rownum <= 1 for update of this_.ID
If we change "for update of this_.ID" to just "for update" it works without error.
Moreover, from my point of view it is more correct, because I want to update another column, but not ID.
Regards,
-Anton
> problem for mixxing setmaxresults and setlockmode
> -------------------------------------------------
>
> Key: HHH-759
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-759
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.0.2
> Environment: Client:windows2000 professional,jre1.4.2, oracle8client,eclipse3.1-RC3,hibernate-tools 3.0 alpha4a,JBossIDE1.5M1
> Server:Solaris 2.8, oracle 8.1.7
> Reporter: johnhua
> Priority: Minor
>
> there is a problem for mixxing setmaxresults and setlockmode.
> the problem is that "ORA-00904: invalid column name".
> The error info is as the below:
> Hibernate: select * from ( select idmapp0_.RI as col_0_0_ from PCTMNGT.IDMAP_P idmapp0_ where idmapp0_.STATUS=? ) where rownum <= ? for update of idmapp0_.RI
> 14:21:54,076 DEBUG AbstractBatcher:AbstractBatcher.java:365 - preparing statement
> 14:21:54,082 DEBUG AbstractBatcher:AbstractBatcher.java:285 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
> 14:21:54,083 DEBUG AbstractBatcher:AbstractBatcher.java:403 - closing statement
> 14:21:54,090 WARN JDBCExceptionReporter:JDBCExceptionReporter.java:71 - SQL Error: 904, SQLState: 42000
> 14:21:54,091 ERROR JDBCExceptionReporter:JDBCExceptionReporter.java:72 - ORA-00904: invalid column name
> The source code is as the below:
> //query an unused emid for new tone
> query = av_session.createQuery("select v_idmap from IdmapP as v_idmap where v_idmap.status=:v_status");
> query.setCharacter("v_status",EMID_STATUS.UNUSED.charValue());
> query.setMaxResults(1);
> query.setLockMode("v_idmap",LockMode.UPGRADE);
> it = query.iterate();
> if( !it.hasNext() )
> {
> tx.rollback();
> lv_err = "addRing::doAddRingFile: no unused EMID for new tone in idmap. toneid="+av_tone;
> throw new InterfaceErrException(lv_err,INTERFACE_RETCODE.SYSTEM_ERR);
> }
--
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.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list