• Post Reply Bookmark Topic Watch Topic
  • New Topic

Extracting One record

 
Chris Lim
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to insert a new record and need to have the next primary key in the table.

So I use
SELECT Max(prikey) FROM table

* @ejb.findersignature="java.lang.String findAccId()"
* query = "SELECT MAX(acc.accId)
FROM Account acc"

How can I return a string?

Please advise. Thanks

[Novice.. starting learning EJB]
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how you would cast a number to a string through an EJB QL. However, you could always implement the same thing as a home method, and use an ejbSelect that does the same thing that returns the number. Afterwards, just have your home method cast it to a string. Just my 2 cents.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!