users@glassfish.java.net

Re: JPA, field as Calendar, accessor returns int

From: <glassfish_at_javadesktop.org>
Date: Mon, 26 May 2008 07:11:48 PDT

Hello Simon,

Two questions for you: How do you want the type defined in the database (int or date) and what access type do you want your provider to use (field or property access)?

If you are using property access, the YearOfRelease type will be considered an int and should not need a temporal annotation. If you want the type to be a date in the database, you would need to mark the getYearOfRelease method as @transient and create an accessor method that returns the calendar and add the temporal annotation to it.

If you are using field access, the yearOfRelease needs the temporal annotation.

You might post the error you get when you do not have the temporal annotation.

Best Regards,
Chris
[Message sent by forum member 'chris_delahunt' (chris_delahunt)]

http://forums.java.net/jive/thread.jspa?messageID=276595