我依赖于休眠模式生成作为工作流的一部分,因为每次提交对模型的更改都很大。我使用生成的模式来完成用于测试环境的脚本。使用的数据库是PostgreSQL。我在INET其中一列中使用自定义postgres类型(我同时保留了IPv4和IPv6值。我需要它提供的类型检查。)为此,我使用了自定义的休眠UserType(InetAddressType.java。)在实体中,我使用特定TypeDef于休眠的方式注册custom UserType,并用ip值列进行注释,Type如Lamp.java@Entity@TypeDef(name = "inet", typeClass = InetAddressType.class)public class Lamp { @Type(type = "inet") public InetAddress getIpAddress() { return ipAddress; }自定义用户类型与从外部休眠状态生成的架构很好地配合使用。但是,当涉及到自动生成时,hibernate决定正确的类型是UUID:create table lamp (id int8 not null, ip_address uuid, primary key (id))有什么方法可以指示休眠模式使用INET而不是UUID?休眠版本为5.2.17.Final。
添加回答
举报
0/150
提交
取消