[Hibernate-JIRA] Created: (HHH-4445) Exception thrown as "unexpected AST node: query [select e.gnteGkey from com.navis.argo.business.extract.Guarantee as e where () order by e.gnteGkey DESC]" when an empty predicate added to the query.
by Ramakrishnan (JIRA)
Exception thrown as "unexpected AST node: query [select e.gnteGkey from com.navis.argo.business.extract.Guarantee as e where () order by e.gnteGkey DESC]" when an empty predicate added to the query.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: HHH-4445
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4445
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Environment: Hibernate-3
MySQL-5.1
Reporter: Ramakrishnan
Getting the following exception when I try to add an empty predicate to the query.
Error Trace:
Hibernate query failed for HQL "select e.gnteGkey from Guarantee as e where () order by e.gnteGkey DESC" with message: unexpected AST node: query [select e.gnteGkey from com.navis.argo.business.extract.Guarantee as e where () order by e.gnteGkey DESC]
Here is the code piece that shows the query composition:
-------------------------Code start----------------------------------------
TableQueryFactory tableQueryFactory = new TableQueryFactory();
DomainQuery query = tableQueryFactory.createDomainQuery(getTable(), getTableDefinition());
UserContext context = getUserContext();
PredicateIntf oacOrCreditPreauthorize = PredicateFactory.in(ArgoExtractField.GNTE_GUARANTEE_TYPE,
new GuaranteeTypeEnum[]{GuaranteeTypeEnum.OAC, GuaranteeTypeEnum.CREDIT_PREAUTHORIZE});
PredicateIntf waiver = PredicateFactory.in(ArgoExtractField.GNTE_GUARANTEE_TYPE, new GuaranteeTypeEnum[]{GuaranteeTypeEnum.WAIVER});
Disjunction disjunction = PredicateFactory.disjunction();
if (ArgoPrivs.UNIT_GUARANTEE_VIEW.isAllowed(context) || ArgoPrivs.UNIT_GUARANTEE_EDIT.isAllowed(context)) {
disjunction.add(oacOrCreditPreauthorize);
}
if (ArgoPrivs.UNIT_WAIVER_VIEW.isAllowed(context) || ArgoPrivs.UNIT_WAIVER_EDIT.isAllowed(context)) {
disjunction.add(waiver);
}
return query.addDqPredicate(disjunction);
-------------------------Code end---------------------------------------
In the above code if both the conditions are not satisfied, the disjunction is simply added without any values( shown as where() in the hql query) and the above mentioned error is thrown when this query is executed.
I could able to solve this by initiating the "disjunction" variable to "null" and at last by adding it to the query if disjunction != null.
It will be helpful if this could be handled at Hibernate level, as if the disjunction doesn't have any predicate values , it could be omitted from the query.
--
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, 9 months
[Hibernate-JIRA] Assigned: (HHH-1595) SQL syntax error on delete statement with subselect
by strong liu (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1595?page=c... ]
strong liu reassigned HHH-1595:
-------------------------------
Assignee: strong liu
> SQL syntax error on delete statement with subselect
> ---------------------------------------------------
>
> Key: HHH-1595
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1595
> Project: Hibernate Core
> Issue Type: Bug
> Components: query-hql
> Affects Versions: 3.1.3
> Environment: Hibernate 3.1.3, Oracle 10g
> Reporter: Georgios Skempes
> Assignee: strong liu
>
> After upgrading from Hibernate 3.1.2 to 3.1.3 I get an SQL syntax error for the HQL statement below. It's a bulk delete containing a subselect. The code is working for Hibernate 3.1.2
> Code between session.open() and session.close():
> ------------------------------------------------------------------------
> String queryString = "delete from Contact con where con.Id.ConpId IN (select conp.Id from con.ContactpersonSet conp where conp.ParId=4711)
> Query queryObject = session.createQuery(queryString);
> queryObject.executeUpdate();
> SQL code generated with Hibernate 3.1.2 (correct):
> ----------------------------------------------------------------------
> delete from CONTACTS where CONP_ID in (select contactper1_.Id from CONTACTPERSONS contactper1_ where CONP_ID=contactper1_.Id and PAR_ID=4711)
> SQL code generated with Hibernate 3.1.3 (error):
> -----------------------------------------------------------------------
> delete from CONTACTS where CONP_ID in (select contactper1_.Id from CONTAKTPERSONS contactper1_ where contact0_.CONP_ID=contactper1_.Id and contactper1_.PAR_ID=?)
> Error log:
> -----------------------------------------------------------------------
> [08:43:01,591] (ERROR) org.hibernate.util.JDBCExceptionReporter.logExceptions(JDBCExceptionReporter.java:72) - ORA-00904: "CONTACT0_"."CONP_ID": invalid identifier
--
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, 9 months
[Hibernate-JIRA] Commented: (HHH-1829) Allow join on any property using property-ref
by Steve Ebersole (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829?page=c... ]
Steve Ebersole commented on HHH-1829:
-------------------------------------
First, the request has merit. I am not against adding such capability.
The issue is that I really just have no idea about the state of the attached patches. Which are pertinent? Which are valid? Also, I get very nervous adding patches when the person contributing them says things like "well this is a hack but..." or "this still has issues but...".
> Allow join on any property using property-ref
> ---------------------------------------------
>
> Key: HHH-1829
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829
> Project: Hibernate Core
> Issue Type: New Feature
> Components: metamodel
> Affects Versions: 3.2.0 cr1, 3.2.0.cr2
> Reporter: Maarten Winkels
> Assignee: Steve Ebersole
> Attachments: AbstractJoinTest.java, HHH-1829-mwinkels.patch, hhh-1829.patch, JoinNoPropertyRefTest.java, JoinPropertyRefTest.java, Person.hbm.xml, Person.java, PersonNoPropertyRef.hbm.xml
>
>
> Currently joining tables for one class (uing the <join...> tag) is only supported for the id property. The property-ref is allowed on the <key..> tag inside the <join..> tag, but this is ignored.
--
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, 9 months
[Hibernate-JIRA] Updated: (HHH-1015) Incorrect SQL generated when one-to-many foreign key is in a discriminated subclass table
by Krasimir Chobantonov (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1015?page=c... ]
Krasimir Chobantonov updated HHH-1015:
--------------------------------------
Attachment: 3.3.2.GA-HHH-1015-v1.patch
Attach a patch for Hibernate Core 3.3.2.GA
> Incorrect SQL generated when one-to-many foreign key is in a discriminated subclass table
> -----------------------------------------------------------------------------------------
>
> Key: HHH-1015
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1015
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1 beta 2
> Environment: Hibernate versions 3.1 beta 3 and 3.0.5
> Reporter: Steven Grimm
> Priority: Minor
> Attachments: 3.3.2.GA-HHH-1015-v1.patch, hhh-1015-version2.patch, hhh-1015.patch
>
>
> I have the following mappings describing a hierarchy of events and a class that the events refer to:
> <hibernate-mapping package="com.xyz">
> <class name="Event" table="event" discriminator-value="-1">
> <id name="Id" type="long" column="event_id"/>
> <discriminator column="event_type_id" type="integer" />
> <subclass name="EventPayer" discriminator-value="-3">
> <join table="event_payer">
> <key column="event_id" />
> <many-to-one name="payer" column="payer_id" class="Payer" />
> </join>
> <subclass name="EventPayerCreated" discriminator-value="1" />
> </subclass>
> </class>
> <class name="Payer" table="payer">
> <id name="payerId" column="payer_id" type="java.lang.Long"/>
> <set name="eventPayers" inverse="true" cascade="save-update">
> <key column="payer_id"/>
> <one-to-many class="EventPayer"/>
> </set>
> </class>
> </hibernate-mapping>
> When I fetch the Payer.eventPayers collection, Hibernate generates this SQL:
> select eventpayer0_.payer_id as payer7_1_,
> eventpayer0_.event_id as event1_1_,
> eventpayer0_.event_id as event1_5_0_,
> eventpayer0_1_.payer_id as payer2_6_0_,
> eventpayer0_.event_type_id as event2_5_0_
> from event eventpayer0_
> inner join event_payer eventpayer0_1_
> on eventpayer0_.event_id=eventpayer0_1_.event_id
> where eventpayer0_.payer_id=?
> The problem is that there is no event.payer_id column; payer_id is in the child table, not the parent. It appears that specifying a discriminated subclass in <one-to-many> is the same as specifying the superclass, or that Hibernate is ignoring the subclass's <join> element. As far as I can tell, this leaves no way to resolve bidirectional associations where one end of the association is in a discriminated subclass, which seems like a perfectly reasonable thing to want to do.
> I also tried changing <key column="payer_id"/> to <key property-ref="payer"/> in the Payer class's <set> element, but got similar behavior in the form of a "property not found" error: Hibernate is either looking in the superclass's properties rather than the subclass's or is ignoring the list of properties in the <join> element.
--
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, 9 months
[Hibernate-JIRA] Commented: (HHH-1352) Session.setReadOnly(Object, boolean) fails for proxies
by Roland Groen (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1352?page=c... ]
Roland Groen commented on HHH-1352:
-----------------------------------
There is a workaround (at least to prevent the exception):
PersistenceContext ctx = ((SessionImplementor)session).getPersistenceContext();
if (ctx.getEntry(t) != null) {
getSession().setReadOnly(t, true);
}
> Session.setReadOnly(Object, boolean) fails for proxies
> ------------------------------------------------------
>
> Key: HHH-1352
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1352
> Project: Hibernate Core
> Issue Type: Bug
> Components: core
> Affects Versions: 3.1
> Environment: Hibernate 3.1, MySQL 5.0.15-nt
> Reporter: Stewart Cambridge
> Assignee: Steve Ebersole
> Priority: Minor
> Original Estimate: 1 day
> Remaining Estimate: 1 day
>
> Session.setReadOnly(Object, boolean) is broken. It throws a TransientObjectException with the message "Instance was not associated with the session" when the object is quite obvious associated with the current session, because we only just loaded it using Session.load(Class, Serializable)
> Here is a simple JUnit test, for an arbitrary entity:
> public void testReadOnly()
> throws Exception
> {
> User user = (User) session.load(User.class, new Long(7));
> System.out.println("\n=== " + user + " ===");
> session.setReadOnly(user, true);
> }
> This is the exception stack trace:
> org.hibernate.TransientObjectException: Instance was not associated with the session at org.hibernate.engine.StatefulPersistenceContext.setReadOnly(StatefulPersistenceContext.java:1167) at org.hibernate.impl.SessionImpl.setReadOnly(SessionImpl.java:1740) at
> test.persistence.HibernateObjectTest.testReadOnly(HibernateObjectTest.java:30) ....
--
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, 9 months
[Hibernate-JIRA] Created: (HHH-3461) Enhance DialectFactory to support Sybase Adaptive Server Anywhere
by Jason Stern (JIRA)
Enhance DialectFactory to support Sybase Adaptive Server Anywhere
-----------------------------------------------------------------
Key: HHH-3461
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3461
Project: Hibernate3
Issue Type: Improvement
Components: core
Affects Versions: 3.2.6
Environment: Hibernate 3.2.6.GA, Sybase Adaptive Server Anywhere
Reporter: Jason Stern
Priority: Minor
Currently, the org.hibernate.dialect.DialectFactory class has native support for Sybase Adaptive Server Enterprise (ASE), but throws the following exception when used with Sybase Adaptive Server Anywhere (ASA):
"org.hibernate.HibernateException: Hibernate Dialect must be explicitly set for database: Adaptive Server Anywhere"
I have manually set the dialect for now, but if you could add the following line of code to the DialectFactory class, it would help with future portability:
MAPPERS.put( "Adaptive Server Anywhere", new VersionInsensitiveMapper( "org.hibernate.dialect.SybaseAnywhereDialect" ) );
Thanks for all your hard 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
14 years, 9 months