HHH-7717 Wrapped "time" column names into "`time`" 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:28 -04:00 committed by brmeyer
parent 36f519d02e
commit 76bb63c74c
4 changed files with 187 additions and 181 deletions

View File

@ -1,86 +1,88 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
* third-party contributors as indicated by either @author tags or express
* copyright attribution statements applied by the authors. All
* third-party contributions are distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.beanvalidation;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.validation.Valid;
import javax.validation.constraints.Future;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.Length;
/**
* @author Emmanuel Bernard
* @author Hardy Ferentschik
*/
@Entity
public class Tv {
@Id
@Size(max = 2)
public String serial;
@Length(max = 5)
public String model;
public int size;
@Size(max = 2)
public String name;
@Future
public Date expDate;
@Size(min = 0)
public String description;
@Min(1000)
public BigInteger lifetime;
@NotNull
@Valid
public Tuner tuner;
@Valid
public Recorder recorder;
@Embeddable
public static class Tuner {
@NotNull
public String frequency;
}
@Embeddable
public static class Recorder {
@NotNull
public BigDecimal time;
}
}
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2010 by Red Hat Inc and/or its affiliates or by
* third-party contributors as indicated by either @author tags or express
* copyright attribution statements applied by the authors. All
* third-party contributions are distributed under license by Red Hat Inc.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate.test.annotations.beanvalidation;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.validation.Valid;
import javax.validation.constraints.Future;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.Length;
/**
* @author Emmanuel Bernard
* @author Hardy Ferentschik
*/
@Entity
public class Tv {
@Id
@Size(max = 2)
public String serial;
@Length(max = 5)
public String model;
public int size;
@Size(max = 2)
public String name;
@Future
public Date expDate;
@Size(min = 0)
public String description;
@Min(1000)
public BigInteger lifetime;
@NotNull
@Valid
public Tuner tuner;
@Valid
public Recorder recorder;
@Embeddable
public static class Tuner {
@NotNull
public String frequency;
}
@Embeddable
public static class Recorder {
@NotNull
@Column(name = "`time`")
public BigDecimal time;
}
}

View File

@ -1,24 +1,26 @@
//$Id$
package org.hibernate.test.annotations.cid;
import java.util.Date;
import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* @author Emmanuel Bernard
*/
@Entity
@AssociationOverrides({
@AssociationOverride(name = "id.channel", joinColumns = @JoinColumn(name = "chan_id", nullable = false)),
@AssociationOverride(name = "id.presenter", joinColumns = @JoinColumn(name = "presenter_name", nullable = false))})
public class TvMagazin {
@EmbeddedId
public TvMagazinPk id;
@Temporal(TemporalType.TIME)
Date time;
}
//$Id$
package org.hibernate.test.annotations.cid;
import java.util.Date;
import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Column;
/**
* @author Emmanuel Bernard
*/
@Entity
@AssociationOverrides({
@AssociationOverride(name = "id.channel", joinColumns = @JoinColumn(name = "chan_id", nullable = false)),
@AssociationOverride(name = "id.presenter", joinColumns = @JoinColumn(name = "presenter_name", nullable = false))})
public class TvMagazin {
@EmbeddedId
public TvMagazinPk id;
@Temporal(TemporalType.TIME)
@Column(name="`time`")
Date time;
}

View File

@ -1,36 +1,37 @@
//$Id$
package org.hibernate.test.annotations.cid;
import java.util.Date;
import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* @author Chandra Patni
*/
@Entity
@SecondaryTable( name = "TV_PROGRAM_EXT", pkJoinColumns = {
@PrimaryKeyJoinColumn( name = "CHANNEL_ID" ),
@PrimaryKeyJoinColumn( name = "PRESENTER_NAME" )
} )
@AssociationOverrides({
@AssociationOverride(name = "id.channel", joinColumns = @JoinColumn(name = "chan_id", nullable = false)),
@AssociationOverride(name = "id.presenter", joinColumns = @JoinColumn(name = "presenter_name", nullable = false))})
public class TvProgram {
@EmbeddedId
public TvMagazinPk id;
@Temporal( TemporalType.TIME )
Date time;
@Column( name = "TXT", table = "TV_PROGRAM_EXT" )
public String text;
//$Id$
package org.hibernate.test.annotations.cid;
import java.util.Date;
import javax.persistence.AssociationOverride;
import javax.persistence.AssociationOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
/**
* @author Chandra Patni
*/
@Entity
@SecondaryTable( name = "TV_PROGRAM_EXT", pkJoinColumns = {
@PrimaryKeyJoinColumn( name = "CHANNEL_ID" ),
@PrimaryKeyJoinColumn( name = "PRESENTER_NAME" )
} )
@AssociationOverrides({
@AssociationOverride(name = "id.channel", joinColumns = @JoinColumn(name = "chan_id", nullable = false)),
@AssociationOverride(name = "id.presenter", joinColumns = @JoinColumn(name = "presenter_name", nullable = false))})
public class TvProgram {
@EmbeddedId
public TvMagazinPk id;
@Temporal( TemporalType.TIME )
@Column(name="`time`")
Date time;
@Column( name = "TXT", table = "TV_PROGRAM_EXT" )
public String text;
}

View File

@ -1,36 +1,37 @@
//$Id$
package org.hibernate.test.annotations.cid;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@SecondaryTable( name = "TV_PROGRAM_IDCLASS", pkJoinColumns =
{
@PrimaryKeyJoinColumn( name = "CHANNEL_ID" ),
@PrimaryKeyJoinColumn( name = "PRESENTER_NAME" )
} )
@IdClass( TvMagazinPk.class )
public class TvProgramIdClass {
@Id
@JoinColumn(nullable=false)
public Channel channel;
@Id
@JoinColumn(nullable=false)
public Presenter presenter;
@Temporal( TemporalType.TIME )
Date time;
@Column( name = "TXT", table = "TV_PROGRAM_IDCLASS" )
public String text;
}
//$Id$
package org.hibernate.test.annotations.cid;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.SecondaryTable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@SecondaryTable( name = "TV_PROGRAM_IDCLASS", pkJoinColumns =
{
@PrimaryKeyJoinColumn( name = "CHANNEL_ID" ),
@PrimaryKeyJoinColumn( name = "PRESENTER_NAME" )
} )
@IdClass( TvMagazinPk.class )
public class TvProgramIdClass {
@Id
@JoinColumn(nullable=false)
public Channel channel;
@Id
@JoinColumn(nullable=false)
public Presenter presenter;
@Temporal( TemporalType.TIME )
@Column(name="`time`")
Date time;
@Column( name = "TXT", table = "TV_PROGRAM_IDCLASS" )
public String text;
}