Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » quoted identifiers
quoted identifiers [message #646766] Thu, 30 December 2010 20:26 Go to next message
Martin Geisse is currently offline Martin GeisseFriend
Messages: 24
Registered: July 2009
Junior Member
Since I just got very useful help, I'll post my next problem Smile

I am using PostgreSQL, so I have to double-quote all identifiers or they'll be implicitly lower-cased. I'd prefer to preserve case since "lastLoginAttemptIpAddress" is so much more readable than "lastloginattemptipaddress".

I have created an orm.xml file with <delimited-identifiers /> (full contents below). That caused EclipseLink to quote most of the identifiers, but it specifically did not quote the column name when defining a foreign key constraint. How can I tell EL to quote *all* identifiers?

I have also read about using quotes in the explicitly specified table / column names to cause EL to quote identifiers. However, (1) that forces me to specify names twice (I already did so in the property accessor names) and in a manner that is invisible to refactoring tools, (2) it is wrong -- the quotes aren't part of the name, (3) it forces me to fix quoting at POJO level when it is actually a specific trait of the database system I am using, (4) it is unclear to me how this could fix the problem when <delimited-identifiers /> doesn't.

orm.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings version="1.0"
	xmlns="http://java.sun.com/xml/ns/persistence/orm"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd">

	<description>description here</description>
	<persistence-unit-metadata>
		<persistence-unit-defaults>
			<delimited-identifiers />
		</persistence-unit-defaults>
	</persistence-unit-metadata>

</entity-mappings>


entity class:
@Entity
public class UserX {
	
	...

	@Id
	@GeneratedValue(generator = "UserX_id_seq")
	@SequenceGenerator(name = "UserX_id_seq", allocationSize = 1)
	public int getId() { ... }

	...

	@ManyToOne(fetch = FetchType.LAZY, optional = false)
	public UserX getModificationUser() { ... }



the generated query (note the missing quotes around the column name):
ALTER TABLE "UserX" ADD CONSTRAINT "FK_UserX_modificationUser_id" FOREIGN KEY (modificationUser_id) REFERENCES "UserX" (id)

Re: quoted identifiers [message #646813 is a reply to message #646766] Fri, 31 December 2010 14:26 Go to previous messageGo to next message
Martin Geisse is currently offline Martin GeisseFriend
Messages: 24
Registered: July 2009
Junior Member
Update: I tried using double-quotes in the explicitly specified column name (in addition to delimited-identifiers) with zero effect -- the column name is still not quoted in the SQL command for the constraint.
Re: quoted identifiers [message #647157 is a reply to message #646766] Tue, 04 January 2011 19:30 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Please log a bug and vote for it.

Using a script to generate the DDL is a workaround.



James : Wiki : Book : Blog : Twitter
Previous Topic:CriteriaBuilder aborted
Next Topic:IN clause in @NamedNativeQuery
Goto Forum:
  


Current Time: Tue Dec 23 01:05:06 GMT 2014

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

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