Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » [SOLVED]Problem with @Converter and smallint field
[SOLVED]Problem with @Converter and smallint field [message #638870] Fri, 12 November 2010 20:28 Go to next message
Daniel Frank is currently offline Daniel FrankFriend
Messages: 14
Registered: July 2010
Junior Member
Hi,
I am using a org.eclipse.persistence.mappings.converters.Converter to convert my enum field to smallint.
The converter works fine if i have a value in this field, but if the field is null eclipselink tries to insert as string.
How can i fix this problem?

[Updated on: Tue, 16 November 2010 19:09]

Report message to a moderator

Re: Problem with @Converter and smallint field [message #639186 is a reply to message #638870] Mon, 15 November 2010 14:53 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Could you include the code for your converter.

You can set the type for the field be defining the Converter's initialize() method and setting the type (or jdbcType) on the field.

i.e.
public void initialize(DatabaseMapping mapping, Session session) {
((DirectToFieldMapping)this.mapping).setFieldClassification( Short.class);
}


James : Wiki : Book : Blog : Twitter
Re: Problem with @Converter and smallint field [message #639515 is a reply to message #638870] Tue, 16 November 2010 19:09 Go to previous message
Daniel Frank is currently offline Daniel FrankFriend
Messages: 14
Registered: July 2010
Junior Member
Awesome!
Thanks man! Works fine now.
Previous Topic:Optimistic locking
Next Topic:[EclipseLink 2.1.1 / SDO] DataGraph Support
Goto Forum:
  


Current Time: Wed Nov 26 08:04:49 GMT 2014

Powered by FUDForum. Page generated in 0.26375 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software