您的位置:首页 > 编程语言 > Java开发

Spring事务--非注解--实体类及映射文件

2011-04-15 15:27 447 查看
package org.niit.springtrans.entities;

import java.util.HashSet;
import java.util.Set;

/**
* Account entity. @author MyEclipse Persistence Tools
*/

public class Account implements java.io.Serializable {

// Fields

private long aid;
private String aname;
private String acontact;
private String aaddress;
private Set cards = new HashSet(0);

// Constructors

/** default constructor */
public Account() {
}

/** minimal constructor */
public Account(long aid) {
this.aid = aid;
}

/** full constructor */
public Account(long aid, String aname, String acontact, String aaddress,
Set cards) {
this.aid = aid;
this.aname = aname;
this.acontact = acontact;
this.aaddress = aaddress;
this.cards = cards;
}

// Property accessors

public long getAid() {
return this.aid;
}

public void setAid(long aid) {
this.aid = aid;
}

public String getAname() {
return this.aname;
}

public void setAname(String aname) {
this.aname = aname;
}

public String getAcontact() {
return this.acontact;
}

public void setAcontact(String acontact) {
this.acontact = acontact;
}

public String getAaddress() {
return this.aaddress;
}

public void setAaddress(String aaddress) {
this.aaddress = aaddress;
}

public Set getCards() {
return this.cards;
}

public void setCards(Set cards) {
this.cards = cards;
}

}


package org.niit.springtrans.entities;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
* Card entity. @author MyEclipse Persistence Tools
*/

public class Card implements java.io.Serializable {

// Fields

private String cid;
private Account account;
private Date applyTime;
private float balance;
private Set tradecredentialsForTbcid = new HashSet(0);
private Set tradecredentialsForTacid = new HashSet(0);

// Constructors

/** default constructor */
public Card() {
}

/** minimal constructor */
public Card(String cid) {
this.cid = cid;
}

/** full constructor */
public Card(String cid, Account account, Date applyTime, float balance,
Set tradecredentialsForTbcid, Set tradecredentialsForTacid) {
this.cid = cid;
this.account = account;
this.applyTime = applyTime;
this.balance = balance;
this.tradecredentialsForTbcid = tradecredentialsForTbcid;
this.tradecredentialsForTacid = tradecredentialsForTacid;
}

// Property accessors

public String getCid() {
return this.cid;
}

public void setCid(String cid) {
this.cid = cid;
}

public Account getAccount() {
return this.account;
}

public void setAccount(Account account) {
this.account = account;
}

public Date getApplyTime() {
return this.applyTime;
}

public void setApplyTime(Date applyTime) {
this.applyTime = applyTime;
}

public float getBalance() {
return this.balance;
}

public void setBalance(float balance) {
this.balance = balance;
}

public Set getTradecredentialsForTbcid() {
return this.tradecredentialsForTbcid;
}

public void setTradecredentialsForTbcid(Set tradecredentialsForTbcid) {
this.tradecredentialsForTbcid = tradecredentialsForTbcid;
}

public Set getTradecredentialsForTacid() {
return this.tradecredentialsForTacid;
}

public void setTradecredentialsForTacid(Set tradecredentialsForTacid) {
this.tradecredentialsForTacid = tradecredentialsForTacid;
}

}


package org.niit.springtrans.entities;

import java.util.Date;

/**
* Tradecredential entity. @author MyEclipse Persistence Tools
*/

public class Tradecredential implements java.io.Serializable {

// Fields

private long tid;
private Card cardByTbcid;
private Card cardByTacid;
private Date ttime;
private float tmoney;

// Constructors

public Tradecredential(Card cardByTacid,Card cardByTbcid, Date ttime,
float tmoney) {
super();
this.cardByTacid = cardByTacid;
this.cardByTbcid = cardByTbcid;
this.ttime = ttime;
this.tmoney = tmoney;
}

/** default constructor */
public Tradecredential() {
}

/** minimal constructor */
public Tradecredential(long tid) {
this.tid = tid;
}

/** full constructor */
public Tradecredential(long tid, Card cardByTbcid, Card cardByTacid,
Date ttime, float tmoney) {
this.tid = tid;
this.cardByTbcid = cardByTbcid;
this.cardByTacid = cardByTacid;
this.ttime = ttime;
this.tmoney = tmoney;
}

// Property accessors

public long getTid() {
return this.tid;
}

public void setTid(long tid) {
this.tid = tid;
}

public Card getCardByTbcid() {
return this.cardByTbcid;
}

public void setCardByTbcid(Card cardByTbcid) {
this.cardByTbcid = cardByTbcid;
}

public Card getCardByTacid() {
return this.cardByTacid;
}

public void setCardByTacid(Card cardByTacid) {
this.cardByTacid = cardByTacid;
}

public Date getTtime() {
return this.ttime;
}

public void setTtime(Date ttime) {
this.ttime = ttime;
}

public float getTmoney() {
return this.tmoney;
}

public void setTmoney(float tmoney) {
this.tmoney = tmoney;
}

}


<?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">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="org.niit.springtrans.entities.Account" table="account" catalog="crm">
<id name="aid" type="long">
<column name="aid" />
<generator class="identity" />
</id>
<property name="aname" type="string">
<column name="aname" length="32">
<comment>客户名</comment>
</column>
</property>
<property name="acontact" type="string">
<column name="acontact" length="64">
<comment>户客联系方式</comment>
</column>
</property>
<property name="aaddress" type="string">
<column name="aaddress" length="128">
<comment>客户家庭住址</comment>
</column>
</property>
<set name="cards" inverse="true">
<key>
<column name="aid">
<comment>客户编号</comment>
</column>
</key>
<one-to-many class="org.niit.springtrans.entities.Card" />
</set>
</class>
</hibernate-mapping>


<?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">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="org.niit.springtrans.entities.Card" table="card" catalog="crm">
<id name="cid" type="string">
<column name="cid" length="64" />
<generator class="assigned" />
</id>
<many-to-one name="account" class="org.niit.springtrans.entities.Account" fetch="select">
<column name="aid">
<comment>客户编号</comment>
</column>
</many-to-one>
<property name="applyTime" type="timestamp">
<column name="applyTime" length="19">
<comment>申请办理时间</comment>
</column>
</property>
<property name="balance" type="float">
<column name="balance" precision="12" scale="0">
<comment>账号余额</comment>
</column>
</property>
<set name="tradecredentialsForTbcid" inverse="true">
<key>
<column name="tbcid" length="64">
<comment>交易乙方卡号</comment>
</column>
</key>
<one-to-many class="org.niit.springtrans.entities.Tradecredential" />
</set>
<set name="tradecredentialsForTacid" inverse="true">
<key>
<column name="tacid" length="64">
<comment>交易甲方卡号(甲方总是出款方)</comment>
</column>
</key>
<one-to-many class="org.niit.springtrans.entities.Tradecredential" />
</set>
</class>
</hibernate-mapping>


<?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">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="org.niit.springtrans.entities.Tradecredential" table="tradecredential" catalog="crm">
<id name="tid" type="long">
<column name="tid" />
<generator class="identity" />
</id>
<many-to-one name="cardByTbcid" class="org.niit.springtrans.entities.Card" fetch="select">
<column name="tbcid" length="64">
<comment>交易乙方卡号</comment>
</column>
</many-to-one>
<many-to-one name="cardByTacid" class="org.niit.springtrans.entities.Card" fetch="select">
<column name="tacid" length="64">
<comment>交易甲方卡号(甲方总是出款方)</comment>
</column>
</many-to-one>
<property name="ttime" type="timestamp">
<column name="ttime" length="19">
<comment>交易时间</comment>
</column>
</property>
<property name="tmoney" type="float">
<column name="tmoney" precision="12" scale="0">
<comment>交易金额</comment>
</column>
</property>
</class>
</hibernate-mapping>


分页相关实体:

package org.niit.springtrans.entities.pagination;

public enum Operation {
PEQ,
PNE,
PGT,
PLT,
PGE,
PLE,
PLIKE
}


package org.niit.springtrans.entities.pagination;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class PageInfo implements Serializable {

private Class clazz;

private int pageIndex=1;

private int pageSize = 10;

private List<PCondition> pconditionList = new ArrayList<PCondition>();

private List<POrder> porderLlist = new ArrayList<POrder>();

private int recordCount;

private int pageCount;

private List result;

public PageInfo() {
super();
}

public Class getClazz() {
return clazz;
}

public void setClazz(Class clazz) {
this.clazz = clazz;
}

public int getPageIndex() {
return pageIndex;
}

public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}

public int getPageSize() {
return pageSize;
}

public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}

public int getRecordCount() {
return recordCount;
}

public void setRecordCount(int recordCount) {
this.recordCount = recordCount;
}

public int getPageCount() {
return pageCount;
}

public void setPageCount(int pageCount) {
this.pageCount = pageCount;
}

public List getResult() {
return result;
}

public void setResult(List result) {
this.result = result;
}

public PageInfo(Class clazz, int pageIndex, int pageSize) {
super();
this.clazz = clazz;
this.pageIndex = pageIndex;
this.pageSize = pageSize;
}

public PageInfo(Class clazz, int pageIndex, int pageSize, int recordCount,
int pageCount, List result) {
super();
this.clazz = clazz;
this.pageIndex = pageIndex;
this.pageSize = pageSize;
this.recordCount = recordCount;
this.pageCount = pageCount;
this.result = result;
}

public PageInfo(Class clazz, int pageIndex, int pageSize,
List<PCondition> pconditionList, List<POrder> porderLlist,
int recordCount, int pageCount, List result) {
super();
this.clazz = clazz;
this.pageIndex = pageIndex;
this.pageSize = pageSize;
this.pconditionList = pconditionList;
this.porderLlist = porderLlist;
this.recordCount = recordCount;
this.pageCount = pageCount;
this.result = result;
}

public List<PCondition> getPconditionList() {
return pconditionList;
}

public void setPconditionList(List<PCondition> pconditionList) {
this.pconditionList = pconditionList;
}

public List<POrder> getPorderLlist() {
return porderLlist;
}

public void setPorderLlist(List<POrder> porderLlist) {
this.porderLlist = porderLlist;
}

}


package org.niit.springtrans.entities.pagination;

import java.io.Serializable;

public class PCondition implements Serializable {

private String propertyName;

private Operation opt = Operation.PEQ;

private Object propertyValue;

public String getPropertyName() {
return propertyName;
}

public void setPropertyName(String propertyName) {
this.propertyName = propertyName;
}

public Operation getOpt() {
return opt;
}

public void setOpt(Operation opt) {
this.opt = opt;
}

public Object getPropertyValue() {
return propertyValue;
}

public void setPropertyValue(Object propertyValue) {
this.propertyValue = propertyValue;
}

public PCondition(String propertyName, Operation opt, Object propertyValue) {
super();
this.propertyName = propertyName;
this.opt = opt;
this.propertyValue = propertyValue;
}

public PCondition() {
super();
}

}


package org.niit.springtrans.entities.pagination;

public enum PDirect {

ASC,
DESC

}


package org.niit.springtrans.entities.pagination;

import java.io.Serializable;

public class POrder implements Serializable {

private String propertyName;
private PDirect pdirect;
public String getPropertyName() {
return propertyName;
}
public void setPropertyName(String propertyName) {
this.propertyName = propertyName;
}
public PDirect getPdirect() {
return pdirect;
}
public void setPdirect(PDirect pdirect) {
this.pdirect = pdirect;
}
public POrder(String propertyName, PDirect pdirect) {
super();
this.propertyName = propertyName;
this.pdirect = pdirect;
}
public POrder() {
super();
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐