Hibernate Map集合映射

package com.renyiwei.wydns.domain;
 
import java.io.Serializable;
import java.util.Map;
 
public class Client implements Serializable {
 
	private static final long serialVersionUID = 4147291866512301737L;
	private Long id;
	private Byte iscompany;
	private String realname;
	private String companyname;
	private String email;
	private String phonenumber;
	private String notes;
	private Integer status = null;
 
	private Map<String, Map<String, String>> addon; //这个该怎么映射呢
 
	/**
	 * 实名认证状态 0:'未认证',1:'认证中',2:'认证成功',3:'认证失败'
	 */
	private Byte certifystatus = null;
 
 
	public Integer getStatus() {
		return status;
	}
 
	public void setStatus(Integer status) {
		this.status = status;
	}
 
	public Long getId() {
		return id;
	}
 
	public void setId(Long id) {
		this.id = id;
	}
 
	public Byte getIscompany() {
		return iscompany;
	}
 
	public void setIscompany(Byte iscompany) {
		this.iscompany = iscompany;
	}
 
	public String getRealname() {
		return realname;
	}
 
	public void setRealname(String realname) {
		this.realname = realname;
	}
 
	public String getCompanyname() {
		return companyname;
	}
 
	public void setCompanyname(String companyname) {
		this.companyname = companyname;
	}
 
	public String getEmail() {
		return email;
	}
 
	public void setEmail(String email) {
		this.email = email;
	}
 
	public String getPhonenumber() {
		return phonenumber;
	}
 
	public void setPhonenumber(String phonenumber) {
		this.phonenumber = phonenumber;
	}
 
 
	public String getNotes() {
		return notes;
	}
 
	public void setNotes(String notes) {
		this.notes = notes;
	}
 
	public Byte getCertifystatus() {
		return certifystatus;
	}
 
	public void setCertifystatus(Byte certifystatus) {
		this.certifystatus = certifystatus;
	}
 
	public Map<String, Map<String, String>> getAddon() {
		return addon;
	}
 
	public void setAddon(Map<String, Map<String, String>> addon) {
		this.addon = addon;
	}
}

映射文件:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
 
	<class name="com.renyiwei.wydns.domain.Client" table="clients">
 
		<id name="id" type="java.lang.Long" length="5">
			<column name="id" ></column>
			<generator class="increment"></generator>
		</id>
		<!-- 
			private Long id;
			private String email;
			private String phonenumber;
		 -->
		<property name="email" type="java.lang.String"></property>
		<property name="phonenumber" type="java.lang.String"></property>
		<map name="addon" table="clientaddons">
			<key column="clientid"></key>
			<map-key column="setting" type="java.lang.String"></map-key>   
			<!--这里待整理-->
			<one-to-many class="java.util.Map"></one-to-many>
		</map>
 
	</class>
</hibernate-mapping>

本文出自 全栈笔记 版权所有,你可以在保留原文地址:Hibernate Map集合映射 及作者的情况下到你的网站或博客。

【上一篇】
【下一篇】

您可能感兴趣的文章:

发表评论

您必须 登录 后才能发表评论。