mardi 25 août 2015

Hibernate - How to set an object witch is pk and fk to be VARCHAR in database?

Hy I have two entity, the first one :

@Entity
@Table(name="E_CMS_CFG")
public class E_CMS_CFG extends BaseEntity{

    @Id
    @OneToOne(cascade=CascadeType.ALL)//, fetch = FetchType.EAGER)
    @JoinColumns({
        @JoinColumn(name = "CFG_TYPE", nullable = false, referencedColumnName = "CFG_TYPE", columnDefinition = "VARCHAR(32)"),
        @JoinColumn(name = "CFG_TYPE_ID", nullable = false, referencedColumnName = "ID")
        })
    private E_CMS_CFG_TYPE cfgType;

and the second one :

@Entity
@Table(name="E_CMS_CFG_TYPE")
public class E_CMS_CFG_TYPE extends BaseEntity{

    @Id
    @Column(name = "CFG_TYPE", length = 32)
    private String cfgType;

In the first one I use columnDefinition = "VARCHAR(32)" on the CFG_TYPE column but in database it is creating a cfg_type integer column, it is possible to create a VARCHAR cfg_type column and not an integer? And if it is, how? I am using Sqlite 3.8.10.1 version.

Aucun commentaire:

Enregistrer un commentaire