[Hibernate-JIRA] Commented: (HHH-1829) Allow join on any property using property-ref
by KrasiG (JIRA)
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1829?page=c... ]
KrasiG commented on HHH-1829:
-----------------------------
up
> 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: Anthony Patricio
> Attachments: AbstractJoinTest.java, HHH-1829-3.2.8-SNAPSHOT.patch, 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
13 years
[Hibernate-JIRA] Created: (HHH-2735) Query . setLockMode cannot find the alias when the query defines a select clause
by Tamir Solomon (JIRA)
Query . setLockMode cannot find the alias when the query defines a select clause
--------------------------------------------------------------------------------
Key: HHH-2735
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2735
Project: Hibernate3
Issue Type: Bug
Reporter: Tamir Solomon
I tried to perform the following :
Query q1 = session.createQuery("select serverIP.server from ServerIP serverIP where serverIP.ip = :ipStr");
q1.setLockMode("serverIP",LockMode.NONE);
q1.setParameter("ipStr", ip);
q1.list();
and i get this error :
Frame : java.lang.IllegalArgumentException: alias not found: serverIP
at org.hibernate.loader.hql.QueryLoader.applyLocks(QueryLoader.java:299)
at org.hibernate.loader.Loader.preprocessSQL(Loader.java:189)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1529)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
at org.hibernate.loader.Loader.list(Loader.java:2090)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:388)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
--
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
13 years
[Hibernate-JIRA] Created: (HHH-5926) Bugs in HQL (order by)
by Ahmed Ali Elsayed Ali Soliman (JIRA)
Bugs in HQL (order by)
----------------------
Key: HHH-5926
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5926
Project: Hibernate Core
Issue Type: Bug
Components: query-hql, query-sql
Affects Versions: 3.6.1
Environment: Application Server: Tomcat 7.0.8
Database: Oracle 11g
Reporter: Ahmed Ali Elsayed Ali Soliman
Attachments: Beans & Mappings.rar
*there is a big problem in HQL & the generated SQL*
this is the hibernate properties in XML
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.query.substitutions">true 'T', false 'F'</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
there is a bug in HQL when i make query.list(hql)
HQL:
select distinct
service.module.component.system,
service.module.component ,
service.module
from Service as service
where service.id in (928, 415)
order by service.module.component.system.orderBy
the generated SQL is
select
distinct system3_.ID as ID149_0_,
component2_.ID as ID150_1_,
module1_.ID as ID151_2_,
system3_.DESCRIPTION as DESCRIPT2_149_0_,
system3_.NAME as NAME149_0_,
system3_.ORDER_BY as ORDER7_149_0_,
system3_.MENU_ID as MENU8_149_0_,
component2_.NAME as NAME150_1_,
component2_.SYSTEM_ID as SYSTEM3_150_1_,
component2_.DESCRIPTION as DESCRIPT4_150_1_,
component2_.ORDER_BY as ORDER8_150_1_,
component2_.PARENT_COMPONENT_ID as PARENT9_150_1_,
module1_.NAME as NAME151_2_,
module1_.WEB_DIRECTORY as WEB3_151_2_,
module1_.MODULE_PATH as MODULE4_151_2_,
module1_.DESCRIPTION as DESCRIPT5_151_2_,
module1_.COMPONENT_ID as COMPONENT9_151_2_,
module1_.ORDER_BY as ORDER10_151_2_
from
SERVICES service0_,
MODULES module1_,
COMPONENTS component2_
inner join
SYSTEMS system3_
on component2_.SYSTEM_ID=system3_.ID,
*SYSTEMS system9_*
where
service0_.MODULE_ID=module1_.ID
and module1_.COMPONENT_ID=component2_.ID
and component2_.SYSTEM_ID=system9_.ID
and (
service0_.ID in (
928 , 415
)
)
order by
*system9_.ORDER_BY*
the errors are
- SQL Error: 1791, SQLState: 42000
- ORA-01791: not a SELECTed expression
the generated SQL is wrong because it add system9_ and no need for it, it has already system3_
there is a column in System bean called orderBy
the hierarchy of beans like this (Service --> Module --> Component --> System)
i attached the beans and mapping
*NOTE: the hql works fine on Hibernate 3.4*
--
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
13 years
[Hibernate-JIRA] Created: (HHH-6326) Oracle10gDialect cause "ORA-00904 - Invalid Identifier" because of wrong ordering of ANSI joins
by Mauro Castaldo (JIRA)
Oracle10gDialect cause "ORA-00904 - Invalid Identifier" because of wrong ordering of ANSI joins
-----------------------------------------------------------------------------------------------
Key: HHH-6326
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6326
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.6.5
Environment: Hibernate 3.6.5, Oracle Database 11g
Reporter: Mauro Castaldo
If you try to execute this simple query
{quote}
select e.lastName, e.department.deptName, e.title from Employee e
{quote}
using Oracle10gDialect you get this:
{code:title=Output|borderStyle=solid}
Hibernate:
select
employee0_.lastName as col_0_0_,
department1_.deptName as col_1_0_,
employee0_.title_id as col_2_0_,
title2_.id as id1_,
title2_.description as descript2_1_
from
Employee employee0_,
Department department1_
inner join
Title title2_
on employee0_.title_id=title2_.id
where
employee0_.dept_no=department1_.deptNo
15/06/2011 20:28:09,626 WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 904, SQLState: 42000
15/06/2011 20:28:09,627 ERROR org.hibernate.util.JDBCExceptionReporter - ORA-00904: "EMPLOYEE0_"."TITLE_ID": invalid identifier
{code}
It seems hibernate ordering of ANSI JOIN blocks is wrong.
The correct query shoul be:
{code:title=Correct query|borderStyle=solid}
select
employee0_.lastName as col_0_0_,
department1_.deptName as col_1_0_,
employee0_.title_id as col_2_0_,
title2_.id as id1_,
title2_.description as descript2_1_
from
Employee employee0_
inner join
Title title2_
on employee0_.title_id=title2_.id,
Department department1_
where
employee0_.dept_no=department1_.deptNo
{code}
You get the same error using HQL or JPQL.
These are the entities I used.
{code:title=Entities|borderStyle=solid}
@Entity
public class Employee implements java.io.Serializable {
private int empNo;
private String firstName;
private String lastName;
private Department department;
private Title title;
@Id
public int getEmpNo() {
return this.empNo;
}
public void setEmpNo(int empNo) {
this.empNo = empNo;
}
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "dept_no")
public Department getDepartment() {
return this.department;
}
public void setDepartment(Department department) {
this.department = department;
}
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "title_id")
public Title getTitle() {
return this.title;
}
public void setTitle(Title title) {
this.title = title;
}
}
@Entity
public class Department implements java.io.Serializable {
private String deptNo;
private String deptName;
@Id
public String getDeptNo() {
return this.deptNo;
}
public void setDeptNo(String deptNo) {
this.deptNo = deptNo;
}
public String getDeptName() {
return this.deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
}
@Entity
public class Title2 implements java.io.Serializable {
private String id;
private String description;
@Id
public String getId() {
return this.id;
}
public void setId(String id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
{code}
--
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
13 years
[Hibernate-JIRA] Created: (HHH-6325) Using Criteria API path.in(...) with ParameterExpression of array fails at binding time
by Oliver Gierke (JIRA)
Using Criteria API path.in(...) with ParameterExpression of array fails at binding time
---------------------------------------------------------------------------------------
Key: HHH-6325
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6325
Project: Hibernate Core
Issue Type: Bug
Components: entity-manager
Affects Versions: 3.6.5
Reporter: Oliver Gierke
Given the following test code snippet:
{code}
User user = new User("Dave", "Matthews", "foo(a)bar.de");
em.persist(user);
em.flush();
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<User> criteria = builder.createQuery(User.class);
Root<User> root = criteria.from(User.class);
criteria.where(root.get("firstname").in(builder.parameter(String[].class)));
TypedQuery<User> query = em.createQuery(criteria);
for (ParameterExpression parameter : criteria.getParameters()) {
query.setParameter(parameter, new String[] { "Dave", "Carter" });
}
List<User> result = query.getResultList();
assertThat(result.isEmpty(), is(false));
{code}
I get a...
{code}
java.lang.IllegalArgumentException: Parameter value [[Ljava.lang.String;@335ad36d] was not matching type [java.lang.String]
at org.hibernate.ejb.AbstractQueryImpl.registerParameterBinding(AbstractQueryImpl.java:360)
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:364)
at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:317)
at org.hibernate.ejb.criteria.CriteriaQueryCompiler$3.setParameter(CriteriaQueryCompiler.java:328)
{code}
If I am using a {{ParameterExpression}} of type {{Collection}} and bind the parameters via {{Arrays.asList(...)}} it works fine. Although it's generally possible to fall back to the collection based binding I'd rather bind the parameter values as is (as I get them handed from somewhere else) without explicit checking and converting.
--
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
13 years