Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » DatabasePlatform: convert varchar to nvarchar for ms sql server(by default, when creating database on sql server, varchar type is created, but in order to support unicode, need nvarchar)
DatabasePlatform: convert varchar to nvarchar for ms sql server [message #825298] Tue, 20 March 2012 13:46 Go to next message
Eclipse UserFriend
need help. I am working on a project to use Eclipselink/JPA to create databases across different database platforms. The requirement is that the created database needs to support Unicode. my code runs well on Oracle, Derby, and other types, but on MS sql server, a varchar type is created by Eclipselink by default. In order to support Unicode, I need nvarchar rather than varchar.

I am not very sure how to implement to intervene Eclipselink's default behavior. I am looking at the org.eclipse.persistence.platform.database.MySQLPlatform, and want to override it, but don't know how to do.

Please give some help!
Re: DatabasePlatform: convert varchar to nvarchar for ms sql server [message #829634 is a reply to message #825298] Mon, 26 March 2012 11:23 Go to previous messageGo to next message
Eclipse UserFriend
In the buildFieldTypes() method change String to map to NVARCHAR instead of VARCHAR.
You can subclass MySQLPlatform with your own class and specify it as your target-database in your persistence.xml.

You could also specify the columnDefinition on your JPA @Column annotation.
Re: DatabasePlatform: convert varchar to nvarchar for ms sql server [message #829725 is a reply to message #829634] Mon, 26 March 2012 13:47 Go to previous message
Eclipse UserFriend
James,

Thank you for the reply. Yes, I got into the same direction and it worked as breeze.
I really appreciate.

[Updated on: Mon, 26 March 2012 13:47] by Moderator

Previous Topic:deadlock in a LAZY fetch
Next Topic:Generate Entities from Tables (Postgres)
Goto Forum:
  


Current Time: Tue Jul 22 20:02:07 EDT 2025

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

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

Back to the top