[Hibernate-JIRA] Commented: (HHH-1902) Alias Problem... Hibernate is replacing our alias at one place but not at another place
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1902?page=c... ]
Max Rydahl Andersen commented on HHH-1902:
------------------------------------------
sorry but no test case, no response.
> Alias Problem... Hibernate is replacing our alias at one place but not at another place
> ---------------------------------------------------------------------------------------
>
> Key: HHH-1902
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1902
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.0.3
> Environment: Hibernate 3.0.3
> Database Platform : MSSQL Server 2000
> Reporter: Paras Dhawan
>
>
> I have a query which contains a sub query in the select list... I have defined an alias of the sub query as _sqry1 now I am putting an Order By clause in the query.... Order By is on the result of the sub query and I have given the alias of the sub query in the Order By clause
> My Query is which i am giving to Hibernate is
> SELECT (SELECT SUM(_0_ServiceCharge_0_service.chargeAmount) FROM Service AS _0_service , ServiceCharge AS _0_ServiceCharge_0_service WHERE _transportService_Challan = _0_service AND _0_service = _0_ServiceCharge_0_service.service) AS _sqry1 FROM Challan AS _Challan LEFT OUTER JOIN _Challan.transportService AS _transportService_Challan ORDER BY _sqry1
> Now the problem is that Hibernate is replacing my aliases.... it replaced my alias of the sub query from _sqry1 to col_0_0_ .... it replaced this alias in the select list but not in the Order By clause... i.e. it replaced the alias where I defined it but it did not replaced the alias where I used it.... so the place where I am using the alias it is giving an error as undefined alias
> The generated SQL by Hibernate:
> select (select SUM(servicecha3_.ChargeAmount) from Services service2_, ServiceCharges servicecha3_ where transports1_.TransportServiceId=service2_.ServiceId and service2_.ServiceId=servicecha3_.serviceGroupTablePKId) as col_0_0_ from Challans challan0_ left outer join TransportServices transports1_ on challan0_.TransportServiceId=transports1_.TransportServiceId left outer join Services transports1_1_ on transports1_.TransportServiceId=transports1_1_.ServiceId order by _sqry1
> when I manually replaced my alias in the Order By clause then my query run successfully
> Either Hibernate should not replace my alias, even if it is replacing then it must replace all the occurences
> I cannot use criteria, I cannot use named queries, i cannot use native sql because my queries are formed at run time, I have to specify a HQL only... This is bug in Hibernate
> Hibernate version: 3.0.5
> Name and version of the database that I am using:
> MS SQL Server 2000
> Full stack trace of any exception that occurs:
> Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query
> at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
> at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
> at org.hibernate.loader.Loader.doList(Loader.java:2148)
> at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
> at org.hibernate.loader.Loader.list(Loader.java:2024)
> at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
> at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
> at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
> at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
> at com.daffodilwoods.framework.utils.HibernateUtil.main(HibernateUtil.java:296)
> Caused by: java.sql.SQLException: [DataDirect][SQLServer JDBC Driver][SQLServer]Invalid column name '_sqry1'.
> at com.ddtek.jdbc.base.BaseExceptions.createException(Unknown Source)
> at com.ddtek.jdbc.base.BaseExceptions.getException(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRPCNonCursorExecuteRequest.submitPrepare(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRPCExecuteRequest.doPrepExec(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRPCExecuteRequest.execute(Unknown Source)
> at com.ddtek.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown Source)
> at com.ddtek.jdbc.base.BaseStatement.commonExecute(Unknown Source)
> at com.ddtek.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
> at com.ddtek.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source)
> at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
> at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
> at org.hibernate.loader.Loader.doQuery(Loader.java:662)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
> at org.hibernate.loader.Loader.doList(Loader.java:2145)
> ... 8 more
--
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
18 years, 5 months
[Hibernate-JIRA] Commented: (HHH-1902) Alias Problem... Hibernate is replacing our alias at one place but not at another place
by Paras Dhawan (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1902?page=c... ]
Paras Dhawan commented on HHH-1902:
-----------------------------------
There are no updates fro your side kindly look into this bug, I have mailed this problem to your experts also but none of them were able to solve it they all said it cannot be done. It is really a major issue which can lead to downfall of Hibernate technology because it is big problem which not taken care of while imlementing Hibernate
The behaviour of Hibernate is very crazy how can it replace my alias... even if it is replacing then also it must replace it every where and not at the place of defining the alias. every occurence must be replaced
Thanks and Regards
Paras Dhawan
> Alias Problem... Hibernate is replacing our alias at one place but not at another place
> ---------------------------------------------------------------------------------------
>
> Key: HHH-1902
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1902
> Project: Hibernate3
> Type: Bug
> Components: query-hql
> Versions: 3.0.3
> Environment: Hibernate 3.0.3
> Database Platform : MSSQL Server 2000
> Reporter: Paras Dhawan
>
>
> I have a query which contains a sub query in the select list... I have defined an alias of the sub query as _sqry1 now I am putting an Order By clause in the query.... Order By is on the result of the sub query and I have given the alias of the sub query in the Order By clause
> My Query is which i am giving to Hibernate is
> SELECT (SELECT SUM(_0_ServiceCharge_0_service.chargeAmount) FROM Service AS _0_service , ServiceCharge AS _0_ServiceCharge_0_service WHERE _transportService_Challan = _0_service AND _0_service = _0_ServiceCharge_0_service.service) AS _sqry1 FROM Challan AS _Challan LEFT OUTER JOIN _Challan.transportService AS _transportService_Challan ORDER BY _sqry1
> Now the problem is that Hibernate is replacing my aliases.... it replaced my alias of the sub query from _sqry1 to col_0_0_ .... it replaced this alias in the select list but not in the Order By clause... i.e. it replaced the alias where I defined it but it did not replaced the alias where I used it.... so the place where I am using the alias it is giving an error as undefined alias
> The generated SQL by Hibernate:
> select (select SUM(servicecha3_.ChargeAmount) from Services service2_, ServiceCharges servicecha3_ where transports1_.TransportServiceId=service2_.ServiceId and service2_.ServiceId=servicecha3_.serviceGroupTablePKId) as col_0_0_ from Challans challan0_ left outer join TransportServices transports1_ on challan0_.TransportServiceId=transports1_.TransportServiceId left outer join Services transports1_1_ on transports1_.TransportServiceId=transports1_1_.ServiceId order by _sqry1
> when I manually replaced my alias in the Order By clause then my query run successfully
> Either Hibernate should not replace my alias, even if it is replacing then it must replace all the occurences
> I cannot use criteria, I cannot use named queries, i cannot use native sql because my queries are formed at run time, I have to specify a HQL only... This is bug in Hibernate
> Hibernate version: 3.0.5
> Name and version of the database that I am using:
> MS SQL Server 2000
> Full stack trace of any exception that occurs:
> Exception in thread "main" org.hibernate.exception.SQLGrammarException: could not execute query
> at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
> at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
> at org.hibernate.loader.Loader.doList(Loader.java:2148)
> at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)
> at org.hibernate.loader.Loader.list(Loader.java:2024)
> at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:375)
> at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:308)
> at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:153)
> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1106)
> at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
> at com.daffodilwoods.framework.utils.HibernateUtil.main(HibernateUtil.java:296)
> Caused by: java.sql.SQLException: [DataDirect][SQLServer JDBC Driver][SQLServer]Invalid column name '_sqry1'.
> at com.ddtek.jdbc.base.BaseExceptions.createException(Unknown Source)
> at com.ddtek.jdbc.base.BaseExceptions.getException(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRPCRequest.processReplyToken(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRPCNonCursorExecuteRequest.submitPrepare(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRPCExecuteRequest.doPrepExec(Unknown Source)
> at com.ddtek.jdbc.sqlserver.tds.TDSRPCExecuteRequest.execute(Unknown Source)
> at com.ddtek.jdbc.sqlserver.SQLServerImplStatement.execute(Unknown Source)
> at com.ddtek.jdbc.base.BaseStatement.commonExecute(Unknown Source)
> at com.ddtek.jdbc.base.BaseStatement.executeQueryInternal(Unknown Source)
> at com.ddtek.jdbc.base.BasePreparedStatement.executeQuery(Unknown Source)
> at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
> at org.hibernate.loader.Loader.getResultSet(Loader.java:1669)
> at org.hibernate.loader.Loader.doQuery(Loader.java:662)
> at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
> at org.hibernate.loader.Loader.doList(Loader.java:2145)
> ... 8 more
--
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
18 years, 5 months
[Hibernate-JIRA] Commented: (HBX-490) Primitive type exception
by Max Rydahl Andersen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-490?page=co... ]
Max Rydahl Andersen commented on HBX-490:
-----------------------------------------
eh yes, that is what the exception states: "Null value was assigned to a property of primitive type..." :)
but it has nothing to do with "default value isn't set", it *should* be set and thus you want it to be set to what the value is, namely a Long.
> Primitive type exception
> ------------------------
>
> Key: HBX-490
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-490
> Project: Hibernate Tools
> Type: Bug
> Versions: 3.1beta2
> Environment: Hibernate 3.1rc2, Oracle 9
> Reporter: George Lindholm
> Priority: Minor
> Fix For: 3.1beta2
>
>
> I want to model/POJO one table (out of a large schema). The table has a reference to another table
> that I'm not modeling:
> <property name="lastUpdtBy" type="long">
> <column name="LAST_UPDT_BY" precision="10" scale="0" />
> </property>
> which hbm2java turns into:
> private long lastUpdtBy;
> public void setLastUpdtBy(long lastUpdtBy) {
> however when I do a find("from ncOrgUnit") I get:
> org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of ca.ubc.nmc.contacts.db.NcOrgUnit.lastUpdtBy
> If I change the method signature to
> public void setLastUpdtBy(Long lastUpdtBy) {
> the exception goes away and things seem to work.
>
--
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
18 years, 5 months
[Hibernate-JIRA] Commented: (HBX-490) Primitive type exception
by Stan (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HBX-490?page=co... ]
Stan commented on HBX-490:
--------------------------
i figured it out. the reason why Long works instead of long is:
the object property in question being loaded up is nullable, and so its reasonable that its default value isnt set.
..but when the pojo is actually created in java, a long must have a value. long cant be set to "null", but Long can.
> Primitive type exception
> ------------------------
>
> Key: HBX-490
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-490
> Project: Hibernate Tools
> Type: Bug
> Versions: 3.1beta2
> Environment: Hibernate 3.1rc2, Oracle 9
> Reporter: George Lindholm
> Priority: Minor
> Fix For: 3.1beta2
>
>
> I want to model/POJO one table (out of a large schema). The table has a reference to another table
> that I'm not modeling:
> <property name="lastUpdtBy" type="long">
> <column name="LAST_UPDT_BY" precision="10" scale="0" />
> </property>
> which hbm2java turns into:
> private long lastUpdtBy;
> public void setLastUpdtBy(long lastUpdtBy) {
> however when I do a find("from ncOrgUnit") I get:
> org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of ca.ubc.nmc.contacts.db.NcOrgUnit.lastUpdtBy
> If I change the method signature to
> public void setLastUpdtBy(Long lastUpdtBy) {
> the exception goes away and things seem to work.
>
--
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
18 years, 5 months