-->
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: Weird problem in named query "Errors in named queries&q
PostPosted: Fri Jul 20, 2007 4:16 am 
Newbie

Joined: Thu Jul 19, 2007 11:43 pm
Posts: 2
Hi everybody..


i found a weird error when using named query..
i am using Hibernate version:3.2.3 GA
and currently deploying on weblogic 8.1..using JDK 1.4.2

I have a named query called "updateUserLogin"..

update versioned UserLogin a set a.status = :statusParam, a.loginFailAttemptNo = :loginFailAttemptNoParam, a.lastLoginFailAttemptDate = :lastLoginFailAttemptDateParam, a.enforceChangePassword = :enforceChangePasswordParam, a.passwordExpired = :passwordExpiredParam, a.lastPasswordChangedDate = :lastPasswordChangedDateParam, a.lastUpdatedBy = :lastUpdatedByParam, a.lastUpdatedDate = :lastUpdatedDateParam where a.id = :idParam


i define the named query inside the <class> element..making the named query callable by
com.xxx.xxx.xxx.UserLogin.updateUserLogin

but when i deploy my app, weblogic generated error "Errors in named queries"

the weird thing is.. this is only happen when first time the application being deployed..
if i remove the named query.. and deploy the application.. start weblogic.. after successfully start.. i shutdown weblogic.. and then put back the named query.. and deploy it again..
there's no such error occur..

so i search the net.. and found out the error "Errors in named queries" occur when checkNameQuery failed during the application startup....

so is it something wrong with my Query ??
or is it a bug?


i had the chance to trace the sessionfactoryimpl and QuerycachePlanCode..

and come up with a guess
well just my guess..

Is it because the "updateUserLogin" query is inside the UserLogin class ?? and then the query itself is trying to update the UserLogin, making the querycheck failed because hibernate haven't finish mapping the UserLogin model to the DB ?..

and then for the case after i remove the name query..
and then successfully deployed and then put back the name query

Is it because of the cache for UserLogin model, so the checknamequery successfully find the model which make the application start successfully ?

hmm im really not so sure..

could anybody give explanation
i will appriciate it so much... thank you


regards,
elanhakim







below is the complete hibernate mapping file of UserLogin.hbm.xml:
<hibernate-mapping>
<class table="IDCS_USER_LOGIN" lazy="true" name="com.stb.idcs.core.model.UserLogin">
<id column="USER_LOGIN_NO" name="id">
<generator class="native"/>
</id>
<version column="VERSION" unsaved-value="undefined" name="version"/>
<many-to-one not-null="true" column="USER_STATUS_NO" lazy="proxy" name="status"/>
<property name="loginFailAttemptNo" column="LOGIN_FAIL_ATTEMPT_NO"/>
<property name="lastLoginFailAttemptDate" type="timestamp" column="LAST_LOGIN_ATTEMPT_DATE"/>
<property name="enforceChangePassword" not-null="true" type="yes_no" column="ENFORCE_CHANGE_PASSWORD_FLAG"/>
<property name="passwordExpired" not-null="true" type="yes_no" column="PASSWORD_EXPIRED_FLAG"/>
<property name="lastPasswordChangedDate" not-null="true" type="timestamp" column="LAST_PASSWORD_CHANGED_DATE"/>
<many-to-one not-null="true" unique="true" column="USER_NO" lazy="proxy" cascade="all" name="user"/>
<property name="createdBy" not-null="true" length="30" type="java.lang.String" column="CREATED_BY" update="false"/>
<property name="createdDate" not-null="true" type="timestamp" column="CREATED_DATE" update="false"/>
<property name="lastUpdatedBy" not-null="true" length="30" type="java.lang.String" column="LAST_UPDATED_BY" update="true"/>
<property name="lastUpdatedDate" not-null="true" type="timestamp" column="LAST_UPDATED_DATE" update="true"/>
<query name="updateUserLogin"><![CDATA[update versioned UserLogin a set a.status = :statusParam, a.loginFailAttemptNo = :loginFailAttemptNoParam, a.lastLoginFailAttemptDate = :lastLoginFailAttemptDateParam, a.enforceChangePassword = :enforceChangePasswordParam, a.passwordExpired = :passwordExpiredParam, a.lastPasswordChangedDate = :lastPasswordChangedDateParam, a.lastUpdatedBy = :lastUpdatedByParam, a.lastUpdatedDate = :lastUpdatedDateParam where a.id = :idParam]]></query>
</class>
</hibernate-mapping>



The complete error message :

Exception:weblogic.management.ApplicationException: start() failed.
Module: STBLive Error: weblogic.management.DeploymentException: Error creating bean with name 'sessionFactory' defined in class path resource [com/stb/idcs/core/conf/spring/spring-idcs-core-persistent.xml]: Initialization of bean failed; nested exception is org.hibernate.HibernateException: Errors in named queries: com.stb.idcs.core.model.relationship.AdminUserRoleRel.getActiveUserRoleRelByAdminUser, com.stb.idcs.core.model.UserLogin.updateUserLogin - with nested exception:
[org.hibernate.HibernateException: Errors in named queries: com.stb.idcs.core.model.relationship.AdminUserRoleRel.getActiveUserRoleRelByAdminUser, com.stb.idcs.core.model.UserLogin.updateUserLogin]
]
at weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(SlaveDeployer.java:2413)
at weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:883)
at weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDeployer.java:591)
at weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:500)
at weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:25)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
>


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.