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(); } }
相关文章推荐
- SpringBoot 使用注解将配置文件自动映射到属性和实体类
- Spring-使用注解和配置文件配置事务
- 注解:配置实体类,并在spring配置文件中配置
- hibernate4与spring4整合时,映射文件和注解
- Spring事务-注解--实体类|数据访问类|业务类
- Spring配置文件applicationContext.xml(3)开启事务和注解
- spring引入实体类映射文件
- Spring事务-注解--装配文件
- spring的事务管理(配置文件方式和注解方式实现、转账环境搭建)
- spring与hibernate整合时实体类映射文件找不到的问题
- hibernate教程____hibernate持久化(基于实体类注解和hbm.xml映射文件区别)
- Hibernate 实体类 映射文件使用注解方式 经典报错以及解决方法
- 通过JPA注解映射视图的实体类 jpa 视图 无主键 @Query注解的用法(Spring Data JPA) jpa 使用sql语句
- Spring中使用事务搭建转账环境方法二 相对简便的注解方法 ——配置文件注入对象属性需要setter方法 注解方法,不需要生成setter方法
- Spring中使用事务搭建转账环境方法二 相对简便的注解方法 ——配置文件注入对象属性需要setter方法 注解方法,不需要生成setter方法
- JPA项目使用myeclipse创建带注解的model实体类&web工程使用MyEclipse自动生成hibernate映射文件和实体类
- Spring MVC @Transactional注解方式事务失效的解决办法
- Spring 使用注解方式进行事务管理--注解回滚机制
- Spring 注解与xml文件混合声明bean
- Sping 学习笔记10——Spring+Hibernate 加载映射文件几种方式