Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 94394 invoked from network); 8 Jan 2010 19:34:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Jan 2010 19:34:43 -0000 Received: (qmail 30845 invoked by uid 500); 8 Jan 2010 19:34:42 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 30781 invoked by uid 500); 8 Jan 2010 19:34:42 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 30771 invoked by uid 99); 8 Jan 2010 19:34:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jan 2010 19:34:42 +0000 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.18.43.133] (HELO sca-es-mail-2.sun.com) (192.18.43.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jan 2010 19:34:32 +0000 Received: from fe-sfbay-09.sun.com ([192.18.43.129]) by sca-es-mail-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id o08JYCUS004688 for ; Fri, 8 Jan 2010 11:34:12 -0800 (PST) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; delsp=yes; format=flowed Received: from conversion-daemon.fe-sfbay-09.sun.com by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0KVY00B000YS5U00@fe-sfbay-09.sun.com> for users@openjpa.apache.org; Fri, 08 Jan 2010 11:34:12 -0800 (PST) Received: from dhcp-usca03-225-122.SFBay.Sun.COM ([unknown] [129.145.225.122]) by fe-sfbay-09.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0KVY00LKS10U1D70@fe-sfbay-09.sun.com> for users@openjpa.apache.org; Fri, 08 Jan 2010 11:34:06 -0800 (PST) Date: Fri, 08 Jan 2010 11:34:04 -0800 From: Craig L Russell Subject: Re: Multibyte characters on SQL Server and Sybase In-reply-to: <1262977233863-4274294.post@n2.nabble.com> Sender: Craig.Russell@Sun.COM To: users@openjpa.apache.org Message-id: <3A42CAD2-E524-4C78-95DF-40A857995480@SUN.com> X-Mailer: Apple Mail (2.936) References: <1262977233863-4274294.post@n2.nabble.com> On Jan 8, 2010, at 11:00 AM, Marc.Boudreau wrote: > > No, the problem is that code can be run on a variety of database > platforms > like DB2, SQL Server, Oracle, etc... > So if I use @Column(columnDefinition="NVARCHAR(256)"), it will only > work on > SQL Server and Sybase, because the other database platforms don't > recognize > the NVARCHAR type. I see. How about having the DataDictionary process the columnDefinition in a database-specific way? IIRC, all of the databases support national use character set columns but in their own way. The columnDefinition is not further standardized in the specification so we can do anything we want to with it. We could analyze the columnDefinition and look for the ANSI standard strings NCHAR(n) and NVARCHAR(n) and translate these into the database- specific type. Craig > > > Craig L Russell wrote: >> >> Hi, >> >> On Jan 8, 2010, at 7:53 AM, Marc Boudreau wrote: >> >>> >>> >>> Currently, OpenJPA maps String fields to VARCHAR on SQLServer and >>> Sybase. >>> There doesn't appear to be a way to cause a String field to be >>> mapped to >>> NVARCHAR other than by using the @Column annotation and settings its >>> columnDefinition to "NVARCHAR". >> >> What is the objection to using this technique on the columns that you >> want to hold national use characters? It seems this use case is >> exactly suited to this feature. >> >>> At the same time, blindly using NVARCHAR >>> for all String fields is too costly in terms of storage space on the >>> database. It ends up limiting the maximum size of the column (less >>> characters can fit because more bytes are used to store them). >>> >>> Unfortunately, the applications we write are required to be database >>> neutral because we support multiple vendors. >>> >>> I'd like to start a discussion on this matter. Here are a couple of >>> points >>> to lead us off... >>> What's the severity of this missing functionality? >>> Could an OpenJPA specific annotation be introduced to allow the >>> mapping >>> tool to use NVARCHAR instead of VARCHAR?. >> >> Is the problem that the OpenJPA mapping tool doesn't support the >> standard columnDefinition annotation in the way you want it to? >> >> Craig >> >>> >>> >>> >>> Marc Boudreau >>> Software Developer >>> IBM Cognos Content Manager >>> marc.boudreau@ca.ibm.com >>> Phone: 613-356-6412 >> >> Craig L Russell >> Architect, Sun Java Enterprise System http://db.apache.org/jdo >> 408 276-5638 mailto:Craig.Russell@sun.com >> P.S. A good JDO? O, Gasp! >> >> >> > > -- > View this message in context: http://n2.nabble.com/Multibyte-characters-on-SQL-Server-and-Sybase-tp4274154p4274294.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. Craig L Russell Architect, Sun Java Enterprise System http://db.apache.org/jdo 408 276-5638 mailto:Craig.Russell@sun.com P.S. A good JDO? O, Gasp!