Faulty support for alias in Hibernate native query
Issue
If I define the following user entity:
@Entity
public class UserEty {
@Id
@SequenceGenerator(name = "seq", sequenceName = "Sq_Id")
@GeneratedValue(generator = "seq")
Long id;
@Column
String username;
and after inserting user1 with name='1' and user2 with name='2' I tried to execute the following query:
select v1.username, v2.username from userety v1, userety v2 where v1.username = '1' and v2.username = '2'
Hibernate gets confused about the aliases.
The request returns 1 row with 2 columns equal to '1' (instead of the first one being '1' and the second one being '2').
Environment
Red Hat JBoss Enterprise Application Platform (EAP) 5.1.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
