[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1952?page=c...
]
Steve Ebersole commented on HHH-1952:
-------------------------------------
Actually, is this still an issue? I am not seeing this behavior at all.
HQL query that uses implicit polymorphism returns (# concrete classes
x n) rows, not n rows, when setMaxResults(n) is used
--------------------------------------------------------------------------------------------------------------------------
Key: HHH-1952
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1952
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.1.3
Environment: Hibernate: 3.1.3
Reporter: David Donn
If I have m mapped entities that implement the same interface and execute a polymorphic
query with setMaxResults(n) I get n x m rows instead of n rows in my result.
Query:
session.createQuery("from Animal").setMaxResults(1)
Hibernate mapping:
<class
name="Lion"
table="lion" lazy="false">
<id name="id">
<generator class="sequence">
<param name="sequence">animal_seq</param>
</generator>
</id>
</class>
<class
name="Tiger"
table="tiger" lazy="false">
<id name="id">
<generator class="sequence">
<param name="sequence">animal_seq</param>
</generator>
</id>
</class>
Class definitions:
public interface Animal {
}
public class Lion implements Animal {
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
public class Tiger implements Animal {
private Long id;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
SQL:
create sequence animal_seq start with 1
/
create table lion (id number(12) primary key)
/
create table tiger (id number(12) primary key)
/
insert into lion values (animal_seq.nextval)
/
insert into tiger values (animal_seq.nextval)
/
--
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