I have two entities, the first of which is:
@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;
The second entity is:
@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 entity, I use columnDefinition = "VARCHAR(32)"
on the CFG_TYPE
column; however, in the database, it is creating a cfg_type
integer column. Is it 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.
UPDATE:
The link did not help, but if I replace in E_CMS_CFG
the @Id
with @NaturalId (mutable = false)
, it works, but it creates it without a primary key.