This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I'm a Hibernate newbie and I've a simple dumb question: I'm trying to construct a HQL statement for searching a database string field. What I want is kind of like:
select n.id from ContactName as n where n.name like attern%
so if the pattern is 'a', I get all the contacts whose name start with an A, for example. However, I can't seem to get this to work -- what's the correct syntax for this? I also tried to add % in the pattern string directly, but that doesn't work neither.
Thanks a lot!!! Adrian
SCJP 1.4, SCWCD 1.4, SCBCD 1.3
David Madouros
Greenhorn
Joined: Mar 08, 2005
Posts: 18
posted
0
If you want the actual ContactName objects back, try using any of the follwing:
Personally, I prefer the first example.
Also, using 'select n.id' will return a List of Long/Integer (depending on how you defined id) if that's what you were trying to do. [ March 08, 2007: Message edited by: David Madouros ]