Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problem with column data type when using Converters(column data type converter problem)
Problem with column data type when using Converters [message #554553] Mon, 23 August 2010 14:19 Go to next message
Mik is currently offline MikFriend
Messages: 3
Registered: August 2010
Junior Member
Hello Forum,

I have a problem with EclipseLink.

I want to persist object attributes with a converter like in the following example:

@Entity
@Converter(
	converterClass=ConverterJTextAreaToString.class,
	name="ConverterJTextAreaToString"
)
public class MyEntity {
	@Convert("ConverterJTextAreaToString")
	@Column(name = "MY_TEXT", nullable=true, length=4000)
	private JTextArea myTextArea;

	public JTextArea getMyTextArea) {
		return myTextArea;
	}
}


In principle this works fine.
However, I also generate my tables with JPA (eclipselink.ddl-generation = create-tables), and whenever I use Converters JPA creates the columns as of type varchar with a length of 255.
The length attribute in the @Column annotation is just ignored, as well as the Java data type returned by the Converter.

Does anyone know how to set the data type with its attribute for a column when using a Converter?

Regards,
Mik

[Updated on: Mon, 23 August 2010 14:23]

Report message to a moderator

Re: Problem with column data type when using Converters [message #554642 is a reply to message #554553] Mon, 23 August 2010 19:43 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

This is a bug in the schema generation. Please log the bug and vote for it.

The issue is the size is not applied if the column type gets defaulted, the size should always be applied.

A workaround is to set the columnDefinition in the Column to include the size.

You should also set the field type in your converters initialize method. Call mapping.setFieldClassification(String.class). This should fix the issue.


James : Wiki : Book : Blog : Twitter
Previous Topic:Two entity manager appointing to the same daba base
Next Topic:NullPointerException in class ObjectReferenceMapping
Goto Forum:
  


Current Time: Thu Apr 25 16:57:55 GMT 2024

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

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

Back to the top