[Hibernate-JIRA] Created: (HHH-5932) Exception ''Invalid filter-parameter name format" from LoadQueryInfluencers when hql contains colon and filter is enabled.
by Tomas Hradec (JIRA)
Exception ''Invalid filter-parameter name format" from LoadQueryInfluencers when hql contains colon and filter is enabled.
--------------------------------------------------------------------------------------------------------------------------
Key: HHH-5932
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5932
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.6.0
Reporter: Tomas Hradec
Hi,
I am getting exception when executing following code:
{code}
@Entity
@FilterDef(name="personIsActiveFilter", defaultCondition="active = 1")
public class Person {
@Id
Long id;
String name;
boolean active;
}
...
session.enableFilter("personIsActiveFilter");
session.createQuery("from Person p where p.name = ':abc'").list();
{code}
Stack trace is the following:
{code}
java.lang.IllegalArgumentException: Invalid filter-parameter name format
at org.hibernate.engine.LoadQueryInfluencers.parseFilterParameterName(LoadQueryInfluencers.java:162)
at org.hibernate.engine.QueryParameters.processFilters(QueryParameters.java:485)
at org.hibernate.engine.QueryParameters.processFilters(QueryParameters.java:458)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1669)
at org.hibernate.loader.Loader.doQuery(Loader.java:801)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
at org.hibernate.loader.Loader.doList(Loader.java:2533)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276)
at org.hibernate.loader.Loader.list(Loader.java:2271)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
{code}
I can´t use named query parameter because whole where clause is built in another part of application.
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-5936) unexpected AST node on HQL UPDATE with composite ID
by Kevin Ferrare (JIRA)
unexpected AST node on HQL UPDATE with composite ID
---------------------------------------------------
Key: HHH-5936
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5936
Project: Hibernate Core
Issue Type: Bug
Components: core
Reporter: Kevin Ferrare
I am trying to execute the following simple HQL update :
UPDATE ProductStorage SET id=:newId WHERE id=:oldId
id is a composite id (composed of "code" and "saleOfficeId")
I get the following exception :
unexpected AST node: AND
I think the cause is that when hibernate tries to split the id in the SET clause, it uses an "AND" instead of a comma
Here is the generated tree that fails (trace log) :
\-[UPDATE] UpdateStatement: 'UPDATE' querySpaces ("product_3f")
+-[FROM] FromClause: 'FROM' FromClause{level=1, fromElementCounter=1, fromElements=1, fromElementByClassAlias=[], fromElementByTableAlias=[productsto0_], fromElementsByPath=[], collectionJoinFromElementsByPath=[], impliedElements=[]}
| \-[FROM_FRAGMENT] FromElement: '"product_3f"' FromElement{explicit,not a collection join,not a fetch join,fetch non-lazy properties,classAlias=null,role=null,tableName="product_3f",tableAlias=productsto0_,origin=null,columns={,className=dto.ProductStorage}}
+-[SET] SqlNode: 'SET'
| \-[AND] BinaryLogicOperatorNode: 'AND'
| +-[EQ] BinaryLogicOperatorNode: '='
| | +-[SQL_TOKEN] SqlFragment: '"code"'
| | \-[SQL_TOKEN] SqlFragment: '?'
| \-[EQ] BinaryLogicOperatorNode: '='
| +-[SQL_TOKEN] SqlFragment: '"saleOfficeId"'
| \-[SQL_TOKEN] SqlFragment: '?'
\-[WHERE] SqlNode: 'WHERE'
\-[AND] BinaryLogicOperatorNode: 'AND'
+-[EQ] BinaryLogicOperatorNode: '='
| +-[SQL_TOKEN] SqlFragment: '"code"'
| \-[SQL_TOKEN] SqlFragment: '?'
\-[EQ] BinaryLogicOperatorNode: '='
+-[SQL_TOKEN] SqlFragment: '"saleOfficeId"'
\-[SQL_TOKEN] SqlFragment: '?'
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-5911) Version number incremented even if all changes of the entity were reverted by an interceptor
by Norbert Sándor (JIRA)
Version number incremented even if all changes of the entity were reverted by an interceptor
--------------------------------------------------------------------------------------------
Key: HHH-5911
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5911
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.6.0
Environment: win xp, java 6
Reporter: Norbert Sándor
In our application we have a Hibernate interceptor which may revert all changes made to an entity in the onFlushDirty() method, based on various conditions. After doing so, our onFlushDirty() implementation returns true indicating that the currentState array has changed.
It works as expected in most cases but we experience the following if all property values are reverted:
- the entity is not updated in the database - as expected
- the version number of the entity is still incremented - this means that the database and the entity will not be in sync after flush
I investigated the problem and found the following code in DefaultFlushEntityEventListener.isVersionIncrementRequired():
Code:
private boolean isVersionIncrementRequired(
FlushEntityEvent event,
EntityEntry entry,
EntityPersister persister,
int[] dirtyProperties
) {
final boolean isVersionIncrementRequired = entry.getStatus()!=Status.DELETED && (
dirtyProperties==null ||
Versioning.isVersionIncrementRequired(
dirtyProperties,
event.hasDirtyCollection(),
persister.getPropertyVersionability()
)
);
return isVersionIncrementRequired;
}
In our case dirtyProperties is null (because all dirty properties were reverted by the interceptor), so isVersionIncrementRequired() will return true. It means that the version is incremented even if no properties were changed and no database update is performed when flushing.
Thanks for your help in advance!
Norbi
--
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, 10 months
[Hibernate-JIRA] Commented: (HHH-16) Explicit joins on unrelated classes
by Joakim Clivemo (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-16?page=com... ]
Joakim Clivemo commented on HHH-16:
-----------------------------------
Regarding my previous comment...
Using HQL that is, exactly like the example in the issue description.
> Explicit joins on unrelated classes
> -----------------------------------
>
> Key: HHH-16
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-16
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: antlr-rework
> Environment: Any
> Reporter: David Lloyd
> Assignee: Steve Ebersole
> Fix For: antlr-rework
>
>
> It would be nice to be able to do explicit joins on unrelated classes with HQL:
> (hope this renders correctly)
> select empl, phone
> from org.example.Employee empl
> left outer join org.example.PhoneBook phone
> on phone.lastName = empl.lastName
> and phone.firstName = empl.firstName
> where empl.salaryGrade > 10
> Note that this would also implicity solve HB-1089 because you could list join criteria that match what Hibernate would have chosen anyway (i.e., list a many-to-one relationship as a criteria explicitly).
> Syntactically this could be disambiguated from the existing join syntax because the token after "join" is a class name rather than a property name.
--
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, 10 months
[Hibernate-JIRA] Commented: (HHH-16) Explicit joins on unrelated classes
by Joakim Clivemo (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-16?page=com... ]
Joakim Clivemo commented on HHH-16:
-----------------------------------
Me and my compandy desperatly need at least the basic functionality to create outer joins on unrelated classes by specifying the ON clause!
Adding criterias by "WITH" or "AND" to the join is pure bonus.
Any progress or fixes in sight to solve this?
> Explicit joins on unrelated classes
> -----------------------------------
>
> Key: HHH-16
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-16
> Project: Hibernate Core
> Issue Type: New Feature
> Components: core
> Affects Versions: antlr-rework
> Environment: Any
> Reporter: David Lloyd
> Assignee: Steve Ebersole
> Fix For: antlr-rework
>
>
> It would be nice to be able to do explicit joins on unrelated classes with HQL:
> (hope this renders correctly)
> select empl, phone
> from org.example.Employee empl
> left outer join org.example.PhoneBook phone
> on phone.lastName = empl.lastName
> and phone.firstName = empl.firstName
> where empl.salaryGrade > 10
> Note that this would also implicity solve HB-1089 because you could list join criteria that match what Hibernate would have chosen anyway (i.e., list a many-to-one relationship as a criteria explicitly).
> Syntactically this could be disambiguated from the existing join syntax because the token after "join" is a class name rather than a property name.
--
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, 10 months
[Hibernate-JIRA] Created: (HHH-4939) Bidirectional OneToOne mapping with FK and composite PK sharing a column throws MappingException
by Chris Wilson (JIRA)
Bidirectional OneToOne mapping with FK and composite PK sharing a column throws MappingException
------------------------------------------------------------------------------------------------
Key: HHH-4939
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4939
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.2
Reporter: Chris Wilson
Attachments: HibernateAnnotationMappingOneToOneTest.java
A bidirectional one-to-one mapping, where the owning side's column is part of a composite primary key, fails to configure, possibly because OneToOneType#getColumnSpan returns zero instead of the actual number of columns used by the join.
When the foreign key column used is not also part of the primary key, or the composite primary key contains only a single column, then the mapping doesn't fail.
{code}
org.hibernate.MappingException: broken column mapping for: journeyComment.id of: org.wfp.rita.test.hibernate.HibernateAnnotationMappingOneToOneTest$Journey
at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:143)
at org.hibernate.persister.entity.AbstractPropertyMapping.initIdentifierPropertyPaths(AbstractPropertyMapping.java:206)
at org.hibernate.persister.entity.AbstractPropertyMapping.initPropertyPaths(AbstractPropertyMapping.java:181)
at org.hibernate.persister.entity.AbstractEntityPersister.initOrdinaryPropertyPaths(AbstractEntityPersister.java:1725)
at org.hibernate.persister.entity.AbstractEntityPersister.initPropertyPaths(AbstractEntityPersister.java:1755)
at org.hibernate.persister.entity.AbstractEntityPersister.postConstruct(AbstractEntityPersister.java:2932)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:431)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:267)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
at org.wfp.rita.test.base.HibernateTestBase.buildSessionFactory(HibernateTestBase.java:93)
at org.wfp.rita.test.base.HibernateTestBase.setUp(HibernateTestBase.java:106)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
{code}
Test case attached. Change HibernateTestBase to org.hibernate.test.annotations.TestCase to run under Hibernate.
--
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, 10 months
[Hibernate-JIRA] Commented: (HHH-1050) HQL Unions
by Lucas de Oliveira Arantes (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1050?page=c... ]
Lucas de Oliveira Arantes commented on HHH-1050:
------------------------------------------------
Same behavior as Nathan and others reported: query gets truncated at the 'union' keyword. Using Hibernate 3.3.2.GA with PostgreSQL 8.4. Query is:
select pr1.value as val, it1.name as description from ProductPrice pr1, Item1 it1 where pr1.relitem.class = 'Item1' and pr1.relitem.id = it1.id
union
select pr2.value as val, it2.observation as description from ProductPrice pr2, Item2 it2 where pr2.relitem.class = 'Item2' and pr2.relitem.id = it2.id
Any plans for this issue to be resolved?
Thanks!
> HQL Unions
> ----------
>
> Key: HHH-1050
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1050
> Project: Hibernate Core
> Issue Type: New Feature
> Components: query-hql
> Reporter: Steve Ebersole
> Assignee: Steve Ebersole
> Fix For: antlr-rework
>
>
> Add the ability to define unions in HQL. Support will be initially limited to only:
> 1) scalar queries : select id from Animal union select id from Car
> 2) the same entity : from Animal where ... union from Animal where ...
> Support both UNION and UNION ALL
--
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, 10 months