Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: AW: [dali-dev] case of table and column names

Hi Adrian,

We do need to come up with a general solution to this problem, as I don't believe it is unique to your situation. I think the best way to proceed here is for you to enter this as a bug and make sure your suggested solution below is included in the bug. It sounds like a feasible solution, so we will certainly take it into consideration. Also, be sure to put in any details on how important this behavior is for you as an adopter, so it can help with prioritization against other bugs and enhancements.

Thanks for looking into this further.

Neil

Goerler, Adrian wrote:

Hi Neil, all,

thanks for the detailed answer.

During the last weeks, we have been analyzig the issue and discussing the different options. Unfortunately, we still have not found a good solution without changing Dali.

Switching the validation to case sensitive from within the JPAPlatform (using org.eclipse.jpt.db.internal.Database caseSensitive) works well and has the desired effect.

However the issue that SAP JPA performs an uppercasing of the default values remains unsolved. I have tried to tackle the issue by extending context classes in the org.eclipse.jpt.core.internal.platform package. However, the defaulting of attributes is implemented way up in the hierarchy in the class JavaAttributeContext so that we basically would end up creating a copy of the entire org.eclipse.jpt.core.internal.platform package. This would not only be a huge effort but would also decouple our platform from all the progress in the core of the Dali implementation.
What we basically need to tackle this issue would be a call back into the IJpaPlatform that would allow us to implement the defaulting according to our requirement. I suggest to introduce a method IJpaPlatfom.convertIdentifier

/**
* If an SQL identifier is derived from a Java identifier by following a * default rule, a JPA implementation may perform some conversion, e.g. * convert the case of the identifier. This method allows to implement * such a conversion in a platform-dependent way. * * @param javaIdentifier the Java identifier to be converted * * @return the converted SQL identifier
*/
String convertIdentifier(String javaIdentifier);
the method would be called from the appropriate locations in the JavaEntityContext, JavaAttributeContext, JavaPersistentAttributeContext and wherever Java identifers are converted to (parts of) SQL identifiers.

We could have a default implementation in the BaseJpaPlatform, of course:

String convertIdentifier(String javaIdentifier) {
  return javaIdentifier;
}

Do you think this would be feasible? Should I suggest this as a "bugfix"?

Best regards,

Adrian







________________________________

Von: dali-dev-bounces@xxxxxxxxxxx [mailto:dali-dev-bounces@xxxxxxxxxxx] Im Auftrag von Neil Hauge
Gesendet: Dienstag, 22. Mai 2007 23:52
An: General Dali EJB ORM developer discussion.
Betreff: Re: [dali-dev] case of table and column names


Adrian,

You raise a  valid issue that we also thought about a while back from a tooling perspective.  Our assumption (given that the spec was not specific) was that applications will run against a case insensitive database schema or will operate where default and specified values must match case sensitive database objects.  We decided that by default, we will ignore case when validating specified and default values, assuming a case insensitive database.  If the org.eclipse.jpt.db.internal.Database caseSensitive boolean is set to true, we will assume that the default or specified value must match the case of the database object in order to be valid and to have proper defaults.  We thought that this caseSensitive setting should be exposed as a user choice, but this is not yet implemented.

If a runtime were to uppercase defaults and also support defaults in a case sensitive DB scenario, then currently the Dali vendor extension would have to override our DB related logic where we retrieve tables and columns.
I'm going to re-examine some of this issue and see if the current solution is the most appropriate.

Neil

Goerler, Adrian wrote:
	Hi Dali-Dev Team,
in SAP JPA, we are facing an issue with the case of table and column names in conjunction with Dali, which I would like to hear your opinion on. The issue is the following: SAP JPA always generates SQL with delimited identifiers, e.g. SELECT "E"."ID", "E"."NAME" FROM "EMPLOYEE" "E" Therefore the case of table and column names is relevant for us. Unfortunately, the JPA specification is not specific with respect to the case of column and table names. We handle the case in SAP JPA as follows: 1) if a default rule applies: upper case e.g. @Basic
	String name; -> "NAME"
2) if a table or column name is specified explicitly: mixed case e.g. @Column(name="theName")
	String name; -> "theName"
Dali on the other hand, when applying default rules, seems to assume that either the case does not matter or that it is preserved (mixed case). To fix the issue, I could imagine to have a property either in our (SAP) JPA runtime (specified in persistence.xml), in the SAP JPA Platform or in Dali that would allow to align the differing behaviours. I would be interested to know which assumptions Dali makes with respect to the case of table and column names. What if the names are specified explicitly using annotations or XML? What if default rules apply? Are the other JPA vendors on this loop facing a similar issue? Best regards, Adrian Dr. Adrian Görler
	SAP AG
	Dietmar-Hopp-Alee 16, 69190 Walldorf Germany
www.sap.com <BLOCKED::http://www.sap.com/>
	

	Sitz der Gesellschaft/Registered Office: Walldorf, Germany
	Vorstand/SAP Executive Board: Henning Kagermann (Sprecher/CEO), Léo Apotheker (stellvertretender Sprecher/Deputy CEO), Werner Brandt, Claus Heinrich, Gerhard Oswald, Peter Zencke
	Vorsitzender des Aufsichtsrats/Chairperson of the SAP Supervisory Board: Hasso Plattner
	Registergericht/Commercial Register Mannheim No HRB 350269
	Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige vertrauliche Informationen enthalten. Sollten Sie diese E-Mail irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts, eine Vervielfältigung oder Weitergabe der E-Mail ausdrücklich untersagt. Bitte benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen Dank.
	This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation.

________________________________


	_______________________________________________
	dali-dev mailing list
	dali-dev@xxxxxxxxxxx
	https://dev.eclipse.org/mailman/listinfo/dali-dev
_______________________________________________
dali-dev mailing list
dali-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dali-dev


Back to the top