HHH-7717 Wrapped "value" column names into "`value`" as they can be

reserved in
some dialects which would cause a test failure.
This commit is contained in:
Esen Sagynov 2012-10-26 11:15:13 -04:00 committed by brmeyer
parent 61cb6f59f6
commit 36f519d02e
14 changed files with 46 additions and 37 deletions

View File

@ -3,6 +3,7 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
@Entity
@Table( name = "char_property" )
@ -11,6 +12,7 @@ public class CharProperty implements Property {
private String name;
@Column(name = "`value`")
private Character value;
public CharProperty() {

View File

@ -3,12 +3,14 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
@Entity
@Table(name="int_property")
public class IntegerProperty implements Property {
private Integer id;
private String name;
@Column(name = "`value`")
private Integer value;
public IntegerProperty() {

View File

@ -3,6 +3,7 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
@Entity
@Table(name = "long_property")
@ -10,7 +11,7 @@ public class LongProperty implements Property {
private Integer id;
private String name;
@Column(name = "`value`")
private Long value;
public LongProperty() {

View File

@ -3,12 +3,14 @@ import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Column;
@Entity
@Table(name="string_property")
public class StringProperty implements Property {
private Integer id;
private String name;
@Column(name = "`value`")
private String value;
public StringProperty() {

View File

@ -26,6 +26,7 @@ package org.hibernate.test.annotations.beanvalidation;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
@ -41,6 +42,7 @@ public class MinMax {
@Max(10)
@Min(2)
@Column(name = "`value`")
private Integer value;
private MinMax() {

View File

@ -10,17 +10,17 @@
<sql-query name="simpleScalar" callable="true">
<return-scalar column="name" type="string"/>
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
{ call simpleScalar(:number) }
</sql-query>
<sql-query name="paramhandling" callable="true">
<return-scalar column="value" type="long" />
<return-scalar column="`value`" type="long" />
<return-scalar column="value2" type="long" />
{ call testParamHandling(?,?) }
</sql-query>
<sql-query name="paramhandling_mixed" callable="true">
<return-scalar column="value" type="long" />
<return-scalar column="`value`" type="long" />
<return-scalar column="value2" type="long" />
{ call testParamHandling(?,:second) }
</sql-query>
@ -34,7 +34,7 @@
<return-property name="regionCode" column="REGIONCODE"/>
<return-property name="employmentId" column="EMPID"/>
<return-property name="salary">
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
</return>

View File

@ -51,7 +51,7 @@
<property name="endDate" column="ENDDATE" insert="false"/>
<property name="regionCode" column="REGIONCODE" update="false"/>
<property name="salary" type="org.hibernate.test.sql.hand.MonetaryAmountUserType">
<column name="VALUE" sql-type="float"/>
<column name="`VALUE`" sql-type="float"/>
<column name="CURRENCY"/>
</property>
<loader query-ref="employment"/>
@ -162,7 +162,7 @@
<return-property name="salary">
<!-- as multi column properties are not supported via the
{}-syntax, we need to provide an explicit column list for salary via <return-property> -->
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
<!-- Here we are remapping endDate. Notice that we can still use {emp.endDate} in the SQL. -->
@ -179,18 +179,18 @@
<sql-query name="simpleScalar" callable="true">
<return-scalar column="name" type="string"/>
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
{ call simpleScalar(:number) }
</sql-query>
<sql-query name="paramhandling" callable="true">
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
<return-scalar column="value2" type="long"/>
{ call paramHandling(?,?) }
</sql-query>
<sql-query name="paramhandling_mixed" callable="true">
<return-scalar column="value" type="long" />
<return-scalar column="`value`" type="long" />
<return-scalar column="value2" type="long" />
{ call paramHandling(?,:second) }
</sql-query>
@ -206,7 +206,7 @@
<return-property name="salary">
<!-- as multi column properties are not supported via the
{}-syntax, we need to provide an explicit column list for salary via <return-property> -->
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
</return>

View File

@ -52,7 +52,7 @@
<property name="endDate" insert="false"/>
<property name="regionCode" update="false"/>
<property name="salary" type="org.hibernate.test.sql.hand.MonetaryAmountUserType">
<column name="VALUE" sql-type="float"/>
<column name="`VALUE`" sql-type="float"/>
<column name="CURRENCY"/>
</property>
<loader query-ref="employment"/>
@ -160,7 +160,7 @@
<return-property name="salary">
<!-- as multi column properties are not supported via the
{}-syntax, we need to provide an explicit column list for salary via <return-property> -->
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
<!-- Here we are remapping endDate. Notice that we can still use {emp.endDate} in the SQL. -->
@ -177,18 +177,18 @@
<sql-query name="simpleScalar" callable="true">
<return-scalar column="name" type="string"/>
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
{ call simpleScalar(:number) }
</sql-query>
<sql-query name="paramhandling" callable="true">
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
<return-scalar column="value2" type="long"/>
{ call paramHandling(?,?) }
</sql-query>
<sql-query name="paramhandling_mixed" callable="true">
<return-scalar column="value" type="long" />
<return-scalar column="`value`" type="long" />
<return-scalar column="value2" type="long" />
{ call paramHandling(?,:second) }
</sql-query>
@ -204,7 +204,7 @@
<return-property name="salary">
<!-- as multi column properties are not supported via the
{}-syntax, we need to provide an explicit column list for salary via <return-property> -->
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
</return>

View File

@ -52,7 +52,7 @@
<property name="endDate" insert="false"/>
<property name="regionCode" update="false"/>
<property name="salary" type="org.hibernate.test.sql.hand.MonetaryAmountUserType">
<column name="VALUE" sql-type="float"/>
<column name="`VALUE`" sql-type="float"/>
<column name="CURRENCY"/>
</property>
<loader query-ref="employment"/>
@ -154,7 +154,7 @@
<return-property name="salary">
<!-- as multi column properties are not supported via the
{}-syntax, we need to provide an explicit column list for salary via <return-property> -->
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
<!-- Here we are remapping endDate. Notice that we can still use {emp.endDate} in the SQL. -->

View File

@ -10,18 +10,18 @@
<sql-query name="simpleScalar" callable="true">
<return-scalar column="name" type="string"/>
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
{ ? = call simpleScalar(:number) }
</sql-query>
<sql-query name="paramhandling" callable="true">
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
<return-scalar column="value2" type="long"/>
{ ? = call testParamHandling(?,?) }
</sql-query>
<sql-query name="paramhandling_mixed" callable="true">
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
<return-scalar column="value2" type="long"/>
{ ? = call testParamHandling(?,:second) }
</sql-query>
@ -35,7 +35,7 @@
<return-property name="regionCode" column="REGIONCODE"/>
<return-property name="employmentId" column="EMPID"/>
<return-property name="salary">
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
</return>

View File

@ -161,7 +161,7 @@
<return-property name="salary">
<!-- as multi column properties are not supported via the
{}-syntax, we need to provide an explicit column list for salary via <return-property> -->
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
<!-- Here we are remapping endDate. Notice that we can still use {emp.endDate} in the SQL. -->
@ -178,18 +178,18 @@
<sql-query name="simpleScalar" callable="true">
<return-scalar column="name" type="string"/>
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
{ call simpleScalar(:number) }
</sql-query>
<sql-query name="paramhandling" callable="true">
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
<return-scalar column="value2" type="long"/>
{ call paramHandling(?,?) }
</sql-query>
<sql-query name="paramhandling_mixed" callable="true">
<return-scalar column="value" type="long" />
<return-scalar column="`value`" type="long" />
<return-scalar column="value2" type="long" />
{ call paramHandling(?,:second) }
</sql-query>
@ -205,7 +205,7 @@
<return-property name="salary">
<!-- as multi column properties are not supported via the
{}-syntax, we need to provide an explicit column list for salary via <return-property> -->
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
</return>

View File

@ -51,7 +51,7 @@
<property name="endDate" column="ENDDATE" insert="false"/>
<property name="regionCode" column="REGIONCODE" update="false"/>
<property name="salary" type="org.hibernate.test.sql.hand.MonetaryAmountUserType">
<column name="VALUE" sql-type="float"/>
<column name="`VALUE`" sql-type="float"/>
<column name="CURRENCY"/>
</property>
<loader query-ref="employment"/>
@ -161,7 +161,7 @@
<return-property name="salary">
<!-- as multi column properties are not supported via the
{}-syntax, we need to provide an explicit column list for salary via <return-property> -->
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
<!-- Here we are remapping endDate. Notice that we can still use {emp.endDate} in the SQL. -->
@ -178,18 +178,18 @@
<sql-query name="simpleScalar" callable="true">
<return-scalar column="name" type="string"/>
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
{ call simpleScalar(:number) }
</sql-query>
<sql-query name="paramhandling" callable="true">
<return-scalar column="value" type="long"/>
<return-scalar column="`value`" type="long"/>
<return-scalar column="value2" type="long"/>
{ call paramHandling(?,?) }
</sql-query>
<sql-query name="paramhandling_mixed" callable="true">
<return-scalar column="value" type="long" />
<return-scalar column="`value`" type="long" />
<return-scalar column="value2" type="long" />
{ call paramHandling(?,:second) }
</sql-query>
@ -205,7 +205,7 @@
<return-property name="salary">
<!-- as multi column properties are not supported via the
{}-syntax, we need to provide an explicit column list for salary via <return-property> -->
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
</return>

View File

@ -53,7 +53,7 @@
<property name="endDate" column="ENDDATE" insert="false"/>
<property name="regionCode" column="REGIONCODE" update="false"/>
<property name="salary" type="org.hibernate.test.sql.hand.MonetaryAmountUserType">
<column name="VALUE" sql-type="float"/>
<column name="`VALUE`" sql-type="float"/>
<column name="CURRENCY"/>
</property>
</class>
@ -246,7 +246,7 @@
<return-property name="element.regionCode" column="REGIONCODE"/>
<return-property name="element.employmentId" column="EMPID"/>
<return-property name="element.salary">
<return-column name="VALUE"/>
<return-column name="`VALUE`"/>
<return-column name="CURRENCY"/>
</return-property>
</return-join>

View File

@ -17,7 +17,7 @@
<column name="NAME" length="20" not-null="true"/>
</property>
<property name="value" type="string">
<column name="VALUE" length="1948"/>
<column name="`VALUE`" length="1948"/>
</property>
</class>