• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJBQL with dates / CMP BLOB Problem  RSS feed

 
Alex Ioannou
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there
Here are two problems.
EJBQL Date Problem
Ok here is a statement :-

Is it possible to format the date field that is returned? My problem is that the seconds and milliseconds keep getting truncated!
I'm using an oracle db, so if I set will it feed the full date back to the server?
CMP BLOB Problem
I have a CMP bean where one of the fields is a BLOB. As the bean is CMP, the java field that maps to the BLOB isn't being converted properly.
As a result my code now looks like this :-

The first line creates the ejb without the BLOB being populated, the second line finishes it off with a manual JDBC call. Is there a better way to do this? I tried putting the 2nd line into but the ejb didn't exist in the database yet!!
Thanks
Al
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alex Ioannou:
Hi there
Here are two problems.
EJBQL Date Problem
Ok here is a statement :-

Is it possible to format the date field that is returned? My problem is that the seconds and milliseconds keep getting truncated!
I'm using an oracle db, so if I set will it feed the full date back to the server?

Unfortunately EJB 2.0 does not support Date comparisons in EJBQL. This is being addressed in EJB 2.1 but of course this does not help you right now. Most vendors support Date comparisons and ordering though they are J2EE extentions that are non-portable.
I suggest you check-out the documentation for your J2EE Server to determine what your options are.
 
Alex Ioannou
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had to manual change the code in the ejb so that the java objects are timestamps.
The issue is highlighted in this piece of code :-

If you convert a date to anything but timestamp then the seconds get chopped off. How annoying.
Now I need help on the other issue regarding those stupid BLOBs.
Al
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!