-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Duplicate Results Querying Table with No Primary Key
PostPosted: Fri Jun 25, 2010 8:46 am 
Newbie

Joined: Mon Dec 14, 2009 5:38 am
Posts: 13
Hello,
I have a table with structure and value like below, with no primary key

table name: service
phone_model (varchar) service (varchar)
--------------------------------------------------------
E71 MMS
E71 GPRS

the table is annotated in a class like this:

Code:
@Entity
@Table(name="service")
public class Service implements Serializable {
   private String phone_model;
   private String service;

  @Id
  public String getPhone_model() {
  ....
 
}


then, I tried to do: List list = session.createQuery("from Service").list();
the result size is 2, but the content is:

E71 MMS
E71 MMS

I tried to use createSQLQuery("select * from service"); also, but the results are the same.

does anyone know why this happen?

thanks,
Faizal


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.