hybris items.xml 中表的联合主键实现

在 items.xsd中是这么定义 unique的

<xs:attribute name="unique" type="xs:boolean" use="optional">
            <xs:annotation>
                <xs:documentation>If ‘true‘, the value of this attribute has to be unique within all instances of this type. If there are multiple attributes marked as unique,

        then their combined values must be unique. Will not be evaluated at jalo layer, if you want to manage the attribute directly using jalo layer you have to               ensure uniqueness manually. Default is ‘false‘.

      </xs:documentation>
            </xs:annotation>
 </xs:attribute>

也就是说 联合主键可以通过 unique指定多个字段来达到要求。具体设置如下

<itemtype code="xxx" autocreate="true" generate="true" jaloclass="com.xxx.core.jalo.OrgSalesUnit">
                <deployment table="xxx" typecode="30001" />
                <attributes>
                    <attribute qualifier="code1" type="String" generate="true">
                        <persistence type="property"></persistence>
                        <modifiers read="true" write="true" search="true" optional="false" unique="true" />
                    </attribute>
                    <attribute qualifier="code2" type="String">
                        <modifiers read="true" write="true" search="true" optional="false" unique="true" />
                        <persistence type="property" />
                    </attribute>
</itemtype>

时间: 2024-08-18 02:45:23

hybris items.xml 中表的联合主键实现的相关文章

《Hibernate学习笔记之三》:联合主键的映射

<Hibernate学习笔记之三>:联合主键的映射 就如在前面所举的例子一样,是使用的id作为唯一的主键,一般情况下我们也只使用唯一的一个属性作为主键,但是在实际中,我们可能会遇到几个属性作为主键的情况,因此,在本篇博文中,就来介绍下,联合主键的映射关系应该如何来做?? 联合主键的映射有两种方式来进行实现. 1.使用映射文件 XXX.bhm.xml 2.使用Annotation Hibernate首先需要使用联合主键的实体类必须实现Serializable接口,即为了使序列能够被序列化进行传输

Hibernate xml配置方法之联合主键

1.StudentPK类,存放Student的联合主键,必须实现java.io.Serializable接口(为了序列化扩充移植),必须重写equals跟hashCode方法(为了确保唯一性) public class StudentPK implements java.io.Serializable{ private int id; private String name; public int getId() { return id; } public void setId(int id)

Hibernate(5)—— 联合主键 、一对一关联关系映射(xml和注解) 和 领域驱动设计

俗话说,自己写的代码,6个月后也是别人的代码……复习!复习!复习!涉及的知识点总结如下: One to One 映射关系 一对一单向外键(XML/Annotation) 一对一双向外键关联(XML/Annotation) 联合主键 一对一单向外键联合主键(Xml/Annotation) 一对一组件关联(XML/Annotation) 理解组件 领域驱动设计——自动生成数据库脚本 一对一关系的小结 一些出错问题的总结 自动生成数据库脚本 一般在项目开发过程中,我们的习惯是先建好数据库和表,然后在进

hibernate 联合主键生成机制(组合主键XML配置方式)

hibernate 联合主键生成机制(组合主键XML配置方式) 如果数据库中用多个字段而不仅仅是一个字段作为主键,也就是联合主键,这个时候就可以使用hibernate提供的联合主键生成策略. 具体如下: 可以使用一个组件作为一个实体类的标识符.你的组件类必须满足以下要求: 它必须实现 java.io.Serializable 接口 它必须重新实现 equals() 和 hashCode() 方法,始终和组合关键字在数据库中的概念保持一致 注意:在 Hibernate3 中,第二个要求并非是 Hi

hybris impex导入 联合主键对象

hybris impex 中的联合主键 对象插入语句 INSERT_UPDATE SomeStatus;code[unique=true];key[unique=true] ;01;approvedStatus ;02;approvedStatus ;01;sendStatus ;02;sendStatus

hibernate里联合主键composite-id映射,查询单个主键的问题(转)

今天项目中遇到这个问题,搞了大半天,我郁闷...hibernate里联合主键配置(多个字段一起作为主键) <class name="com.cskj.hibernate.map.BbWjjc" table="bb_wjjc" schema="dbo" catalog="wjgl">        <composite-id name="id" class="com.cskj.hi

hibernate里联合主键composite-id映射,查询单个主键的问题

今天项目中遇到这个问题,搞了大半天,现在记录下来hibernate里联合主键配置(多个字段一起作为主键) <class name="com.cskj.hibernate.map.BbWjjc" table="bb_wjjc" schema="dbo" catalog="wjgl"> <composite-id name="id" class="com.cskj.hibernate

Hibernate 中 联合主键映射 组合关系映射 大对象映射(或者说文本大对象,二进制数据大对象)

Clob:文本大对象,最长4G Blob:二进制数据大对象,最长4G util: public class HibUtil { private static SessionFactory sessionFactory; static{ //获取配置信息 hibernate.cfg.xml Configuration configuration = new Configuration().configure(); //创建一个 ServiceRegistry的实例 //首先获得其标准建造器,此处用

Hibernate学习笔记_联合主键

复合主键(联合主键):多个字段构成唯一性. 一,xml方式 1. 将联合主键的属性提取出来,重新编写一个StudentPK类(原Student类中的id,name要删除 并新加入属性“StudentPK”) //StudentPK .javapackage com.bjsxt.hibernate; public class StudentPK implements java.io.Serializable{ private int id; private String name; public