• Post Reply Bookmark Topic Watch Topic
  • New Topic

String as a primary key

 
Baba Bizlowsky
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Silly question:

My bean has a String as a primary key. However, when I try to get it's local interface with findByPrimaryKey(id), it cannot be found.

If I make Integer as PK, it works.

Can somebody please tell me what stupid things could I be missing? Is there a special way to treat String PKs apart from Integer ones?

Thanks in advance.
 
Baba Bizlowsky
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
plot thickens..

The question isn't actually so silly. Please read on..

My program works like this - the class doing the actual search is a message drive bean. It gets a JMS message which has the String id in question in it's message properties. So the code goes like this:



And I get an error saying:


However if I HARDCODE THE SAME STRING like this:


it works! Why?? I have triple-checked the JMS sending code and everything is ok.

What does the JMS property do to a String that it cannot be further used as a primary key? Is there something obvious that I'm somehow missing??
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!