-->
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: Hibernate returning not returning any result using valid que
PostPosted: Sat Mar 23, 2013 7:04 pm 
Newbie

Joined: Sat Mar 23, 2013 6:58 pm
Posts: 1
I have been scratching my head for a while and i still have no real solution, this is a strange problem. I have an entity:
Code:
@Entity
    @Table(name = "BUYER_EXTERNAL_ID")
public class BuyerExternalId implements Serializable {

  private static final long serialVersionUID = 1L;

  @Id
  @Basic(optional = false)
  @Column(name = "ID", nullable = false)
  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "BuyerExternalIdSequence")
  @SequenceGenerator(name = "BuyerExternalIdSequence", initialValue = 1, sequenceName = "buyer_external_id_seq")
  private Long id;

  @Basic(optional = false)
  @Column(name = "EXTERNAL_ID", nullable = false, length = 30)
  private String externalId;

  @Basic(optional = false)
  @Enumerated(EnumType.STRING)
  @Column(name = "MODULE_NAME", nullable = false, length = 20)
  private IdentityModule module;
}


The following code returns a value
Code:
em.createQuery("SELECT bei FROM BuyerExternalId bei WHERE bei.id = 2").getResultList();

But this code doesn't:
Code:
em.createQuery("SELECT bei FROM BuyerExternalId bei WHERE bei.externalId =  '102' ").getResultList();

Variations of these queries using named parameters are behaving the same. Only when i try to get the values by externalId property. I am using Derby database, I figured I should log the actual sql send to the server and sure enough its correct and when I run that sql it returns values.


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.