[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] quoting problem with PostgreSQL
|
Hello,
I am moving this here from the community forum since the forum isn't very active and there seems to be little overlap in the people posting.
With PostgreSQL, 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 (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 tried using quotes in the explicitly specified table / column names to cause EL to quote identifiers. First and foremost, that doesn't work either -- same behavior. In addition to that, it forces me to specify names twice (in the annotation AND in the property accessor names) and in a manner that is invisible to refactoring tools. It also forces me to fix quoting at POJO level when it is actually a specific trait of the database system I am using.
Thank you in advance.
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)
----------------------------