Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » [Solved] Eclipselink 2.5 + MSSQL (jtds) escaping table names
[Solved] Eclipselink 2.5 + MSSQL (jtds) escaping table names [message #1140383] Wed, 16 October 2013 10:13 Go to next message
Neikius Mising name is currently offline Neikius Mising nameFriend
Messages: 43
Registered: April 2011
Member
Hello,

I've noticed that Eclipselink automatically escapes table names in MSSQL also. BUT it will escape the table names in double quotes.

As far as I know this is the source of my problem : [dbo].[table name] should work, while "[dbo]"."[table name]" does not.

It could be something else, but I want to try this first. How would I turn off automatic escaping in double quotes? Actually, even better would be if it escaped names using [] instead of double quotes no? When user sets property <property name="eclipselink.target-database" value="SQLServer"/> for example?

[Updated on: Wed, 06 November 2013 12:09]

Report message to a moderator

Re: Eclipselink 2.5 + MSSQL (jtds) escaping table names [message #1142212 is a reply to message #1140383] Thu, 17 October 2013 13:19 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member
It should not escape table names by default, so check your settings - specifically for a delimited-identifiers tag in an orm.xml file, or that the table name definitions do not include '/"' escapes. The " delimiter is the default on DatabasePlatform, and can be changed using the setStartDelimiter and setEndDelimiter methods via a session customizer http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Customizers

Re: Eclipselink 2.5 + MSSQL (jtds) escaping table names [message #1142213 is a reply to message #1140383] Thu, 17 October 2013 13:20 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member


[Updated on: Thu, 17 October 2013 14:47]

Report message to a moderator

Re: Eclipselink 2.5 + MSSQL (jtds) escaping table names [message #1142214 is a reply to message #1140383] Thu, 17 October 2013 13:20 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member

[Updated on: Thu, 17 October 2013 14:47]

Report message to a moderator

Re: Eclipselink 2.5 + MSSQL (jtds) escaping table names [message #1173277 is a reply to message #1140383] Wed, 06 November 2013 12:09 Go to previous message
Neikius Mising name is currently offline Neikius Mising nameFriend
Messages: 43
Registered: April 2011
Member
Not sure why I had to do this, having specified MSSQL as my platform... at least it works fine now. Had to dig a bit more though but thanks for the correct pointers Smile

public class DatabaseCustomizer implements SessionCustomizer {

	public void customize(Session session) {
		DatasourcePlatform platform = session.getPlatform();
		platform.setStartDelimiter("[");
		platform.setEndDelimiter("]");
	}
}


And persistence.xml

<persistence-unit>
   <persistence>
...
      <properties>
         <property name="eclipselink.target-database" value="SQLServer"/>
         <property name="eclipselink.session.customizer" value="si.result.internal.ure.service.data.customizer.DatabaseCustomizer"/>
      </properties>
...
   </persistence-unit>
</persistence>
Previous Topic:Asking for advise (Failover question)
Next Topic:Retrieve object and dependencies with only one SQL request
Goto Forum:
  


Current Time: Sun Nov 23 10:12:10 GMT 2014

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

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