`
jayce洪
  • 浏览: 23049 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

Hibernate 三级关联笔记

阅读更多
Hibernate 三级关联笔记
实体类关系如下:
                                                          →QingAoPlaceCdmaSector
QingAoCenterInfo→QingAoPlaceInfo→QingAoPlaceLteSector               删除Center时要删除Center下所有的Place以及网元
                                                          → QingAoAp

实体类代码:
QingAoCenterInfo.java
package com.yuqiaotech.nttelcom.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
* 青奥重点场所信息表。
*
*/
@Entity(name="QING_AO_CENTER_INFO")
@Table(name="QING_AO_CENTER_INFO")
public class QingAoCenterInfo {
private Long id;
private String centerName; //重点场所名称
private Long alarmNum; //告警数
private String note; //备注
private String iconName; //图标名称
private String cityName; //所在城市
private String type; //重点场所、活动保障
private Date createTime;
private List<QingAoPlaceInfo> qingAoPlaceInfo; //场所拥有的场馆
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
/**
* @searchItem
* displayType="text"
*
* 重点场所名称
* @return
*/
public String getCenterName() {
return centerName;
}
public void setCenterName(String centerName) {
this.centerName = centerName;
}
/**
* 告警数
* @return
*/
public Long getAlarmNum() {
return alarmNum;
}
public void setAlarmNum(Long alarmNum) {
this.alarmNum = alarmNum;
}
/**
* 备注
* @return
*/
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
/**
* 图标名称
* @return
*/
public String getIconName() {
return iconName;
}
public void setIconName(String iconName) {
this.iconName = iconName;
}

public String getCityName() {
return cityName;
}

public void setCityName(String cityName) {
this.cityName = cityName;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@OneToMany(mappedBy="qingAoCenterInfo",cascade= CascadeType.ALL)
public List<QingAoPlaceInfo> getQingAoPlaceInfo() {
return qingAoPlaceInfo;
}
public void setQingAoPlaceInfo(List<QingAoPlaceInfo> qingAoPlaceInfo) {
this.qingAoPlaceInfo = qingAoPlaceInfo;
}
}


QingAoPlaceInfo.java
package com.yuqiaotech.nttelcom.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
* 场馆信息。
*
*/
@Entity(name="QING_AO_PLACE_INFO")
@Table(name="QING_AO_PLACE_INFO")
public class QingAoPlaceInfo {
private Long id;
private QingAoCenterInfo qingAoCenterInfo;// 重点场所id
private String placeName;// 场馆名称
private String note;// 备注
private String openStat;// 开通状态
private Long displayOrder;
private String cityName;
private Date createTime;
private List<QingAoPlaceCdmaSector> qingAoPlaceCdmaSector;//拥有的cdma
private List<QingAoPlaceLteSector> qingAoPlaceLteSector;//拥有的Lte
private List<QingAoAp> qingAoAp; //拥有的Ap


@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

@ManyToOne(fetch=FetchType.LAZY )
@JoinColumn(name="f_center_id")
public QingAoCenterInfo getQingAoCenterInfo() {
return qingAoCenterInfo;
}

public void setQingAoCenterInfo(QingAoCenterInfo qingAoCenterInfo) {
this.qingAoCenterInfo = qingAoCenterInfo;
}
/**
* @searchItem
* displayType="text"
* 场所名称
* @return
*/
public String getPlaceName() {
return placeName;
}
public void setPlaceName(String placeName) {
this.placeName = placeName;
}

public String getNote() {
return note;
}

public void setNote(String note) {
this.note = note;
}

public String getOpenStat() {
return openStat;
}

public void setOpenStat(String openStat) {
this.openStat = openStat;
}

public Long getDisplayOrder() {
return displayOrder;
}

public void setDisplayOrder(Long displayOrder) {
this.displayOrder = displayOrder;
}

public String getCityName() {
return cityName;
}

public void setCityName(String cityName) {
this.cityName = cityName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@OneToMany(mappedBy="qingAoPlaceInfo",cascade= CascadeType.ALL)
public List<QingAoPlaceCdmaSector> getQingAoPlaceCdmaSector() {
return qingAoPlaceCdmaSector;
}

public void setQingAoPlaceCdmaSector(
List<QingAoPlaceCdmaSector> qingAoPlaceCdmaSector) {
this.qingAoPlaceCdmaSector = qingAoPlaceCdmaSector;
}
@OneToMany(mappedBy="qingAoPlaceInfo",cascade= CascadeType.ALL)
public List<QingAoPlaceLteSector> getQingAoPlaceLteSector() {
return qingAoPlaceLteSector;
}

public void setQingAoPlaceLteSector(
List<QingAoPlaceLteSector> qingAoPlaceLteSector) {
this.qingAoPlaceLteSector = qingAoPlaceLteSector;
}
@OneToMany(mappedBy="qingAoPlaceInfo",cascade= CascadeType.ALL)
public List<QingAoAp> getQingAoAp() {
return qingAoAp;
}

public void setQingAoAp(List<QingAoAp> qingAoAp) {
this.qingAoAp = qingAoAp;
}
}

QingAoPlaceCdmaSector.java
package com.yuqiaotech.nttelcom.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
* 青奥场馆CDMA扇区信息
*
* @author liuhao
*
*/
@Entity(name = "QING_AO_PLACE_CDMA_SECTOR")
@Table(name = "QING_AO_PLACE_CDMA_SECTOR")
public class QingAoPlaceCdmaSector {

private Long id;
private QingAoPlaceInfo qingAoPlaceInfo; // 场馆id
private Long sectorId;// 扇区id
private String cityName;// 地市
private Long bsc;// bsc编号
private Long btsId;// 基站编号
private Long accessSector;// 扇区编号
private String sectorName;// 扇区名称
private String sectorNameExcel;// 扇区excel名称
private String openStat;// 开通状态
private Long alarmNum;// 告警数
private Date updateTime;// 最后更新时间
private Long pmAlarmNum;// 性能告警数量
private Long positionLeft;
private Long positionTop;
private Long displayOrder;
private String cellid;// 1x小区号
private String cellidDo;// do小区号
private Date createTime;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="F_PLACE_ID")
public QingAoPlaceInfo getQingAoPlaceInfo() {
return qingAoPlaceInfo;
}

public void setQingAoPlaceInfo(QingAoPlaceInfo qingAoPlaceInfo) {
this.qingAoPlaceInfo = qingAoPlaceInfo;
}

/**
* @searchItem
* displayType="text"
* @return
*/
public Long getSectorId() {
return sectorId;
}

public void setSectorId(Long sectorId) {
this.sectorId = sectorId;
}

public String getCityName() {
return cityName;
}

public void setCityName(String cityName) {
this.cityName = cityName;
}

@Column(name="BSC")
public Long getBsc() {
return bsc;
}

public void setBsc(Long bsc) {
this.bsc = bsc;
}

@Column(name="BTS_ID")
public Long getBtsId() {
return btsId;
}

public void setBtsId(Long btsId) {
this.btsId = btsId;
}

@Column(name="ACCESS_SECTOR")
public Long getAccessSector() {
return accessSector;
}

public void setAccessSector(Long accessSector) {
this.accessSector = accessSector;
}

public String getSectorName() {
return sectorName;
}

public void setSectorName(String sectorName) {
this.sectorName = sectorName;
}

public String getSectorNameExcel() {
return sectorNameExcel;
}

public void setSectorNameExcel(String sectorNameExcel) {
this.sectorNameExcel = sectorNameExcel;
}

public String getOpenStat() {
return openStat;
}

public void setOpenStat(String openStat) {
this.openStat = openStat;
}

public Long getAlarmNum() {
return alarmNum;
}

public void setAlarmNum(Long alarmNum) {
this.alarmNum = alarmNum;
}

public Date getUpdateTime() {
return updateTime;
}

public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}

public Long getPmAlarmNum() {
return pmAlarmNum;
}

public void setPmAlarmNum(Long pmAlarmNum) {
this.pmAlarmNum = pmAlarmNum;
}

public Long getPositionLeft() {
return positionLeft;
}

public void setPositionLeft(Long positionLeft) {
this.positionLeft = positionLeft;
}

public Long getPositionTop() {
return positionTop;
}

public void setPositionTop(Long positionTop) {
this.positionTop = positionTop;
}

public Long getDisplayOrder() {
return displayOrder;
}

public void setDisplayOrder(Long displayOrder) {
this.displayOrder = displayOrder;
}

public String getCellid() {
return cellid;
}

public void setCellid(String cellid) {
this.cellid = cellid;
}

public String getCellidDo() {
return cellidDo;
}

public void setCellidDo(String cellidDo) {
this.cellidDo = cellidDo;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}

QingAoPlaceLteSector.java
package com.yuqiaotech.nttelcom.model;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
/**
* 青奥场馆Lte扇区信息。
* @author jayce
*
*/
@Entity(name="QING_AO_PLACE_LTE_SECTOR")
@Table(name="QING_AO_PLACE_LTE_SECTOR")
public class QingAoPlaceLteSector {
private Long id;
private QingAoPlaceInfo qingAoPlaceInfo; //场馆具体place
private Long sectorId; //扇区ID
private String cityName; //地市
private Long siteId; //基站编号
private Long cellId; //小区标识
private Long localCellId; //本地校区标识
private String sectorName; //扇区名称
private String sectorNameExcel; //扇区excel名称
private String openStat; //开通状态
private Long alarmNum; //告警数
private Date updateTime; //最后更新时间
private Long positionLeft;
private Long positionTop;
private Date createTime;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="f_place_id")
public QingAoPlaceInfo getQingAoPlaceInfo() {
return qingAoPlaceInfo;
}
public void setQingAoPlaceInfo(QingAoPlaceInfo qingAoPlaceInfo) {
this.qingAoPlaceInfo = qingAoPlaceInfo;
}
/**
* @searchItem
* displayType="text"
* 扇区ID
* @return
*/
public Long getSectorId() {
return sectorId;
}
public void setSectorId(Long sectorId) {
this.sectorId = sectorId;
}

/**
* @searchItem
* displayType="text"
* 城市名称
* @return
*/
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}

/**
* @searchItem
* displayType="text"
* 基站编号
* @return
*/
public Long getSiteId() {
return siteId;
}
public void setSiteId(Long siteId) {
this.siteId = siteId;
}

/**
* @searchItem
* displayType="text"
* 校区编号
* @return
*/
public Long getCellId() {
return cellId;
}
public void setCellId(Long cellId) {
this.cellId = cellId;
}

/**
* @searchItem
* displayType="text"
* 本地小区编号
* @return
*/
public Long getLocalCellId() {
return localCellId;
}
public void setLocalCellId(Long localCellId) {
this.localCellId = localCellId;
}

/**
* @searchItem
* displayType="text"
* 扇区名称
* @return
*/
public String getSectorName() {
return sectorName;
}
public void setSectorName(String sectorName) {
this.sectorName = sectorName;
}

/**
* @searchItem
* displayType="text"
* 扇区excel名称
* @return
*/
public String getSectorNameExcel() {
return sectorNameExcel;
}
public void setSectorNameExcel(String sectorNameExcel) {
this.sectorNameExcel = sectorNameExcel;
}
public String getOpenStat() {
return openStat;
}
public void setOpenStat(String openStat) {
this.openStat = openStat;
}
public Long getAlarmNum() {
return alarmNum;
}
public void setAlarmNum(Long alarmNum) {
this.alarmNum = alarmNum;
}

/**
* @Editor
* type="date"
* @return
*/
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getPositionLeft() {
return positionLeft;
}
public void setPositionLeft(Long positionLeft) {
this.positionLeft = positionLeft;
}
public Long getPositionTop() {
return positionTop;
}
public void setPositionTop(Long positionTop) {
this.positionTop = positionTop;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}

}

QingAoAp.java
package com.yuqiaotech.nttelcom.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
* 城市热点WiFi
* @author liuhao
*
*/
@Entity(name="QING_AO_AP")
@Table(name="QING_AO_AP")
public class QingAoAp {
private Long id;
private String apName;
private String position;
private String ip;
private Long deviceId;
private String apNameExcel;
private QingAoPlaceInfo qingAoPlaceInfo;
private String cityName;
private Date createTime;

@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

/**
* @searchItem
* displayType="text"
* @return
*/
public String getApName() {
return apName;
}

public void setApName(String apName) {
this.apName = apName;
}

/**
* @searchItem
* displayType="text"
* @return
*/
public String getPosition() {
return position;
}

public void setPosition(String position) {
this.position = position;
}

public String getIp() {
return ip;
}

public void setIp(String ip) {
this.ip = ip;
}

public Long getDeviceId() {
return deviceId;
}

public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}

public String getApNameExcel() {
return apNameExcel;
}

public void setApNameExcel(String apNameExcel) {
this.apNameExcel = apNameExcel;
}

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="F_PLACE_ID")
public QingAoPlaceInfo getQingAoPlaceInfo() {
return qingAoPlaceInfo;
}

public void setQingAoPlaceInfo(QingAoPlaceInfo qingAoPlaceInfo) {
this.qingAoPlaceInfo = qingAoPlaceInfo;
}

public String getCityName() {
return cityName;
}

public void setCityName(String cityName) {
this.cityName = cityName;
}
public Date getCreateTime() {
return createTime;
}

public void setCreateTime(Date createTime) {
this.createTime = createTime;
}

}
分享到:
评论

相关推荐

    《深入浅出Hibernate》读书笔记

    读书笔记主要涉及了实体对象的生命周期、实体对象的识别以及数据缓存这三大核心概念。 首先,实体对象的生命周期是Hibernate中至关重要的概念。它包括三个状态:Transient(自由状态)、Persistent(持久状态)和...

    hibernate笔记

    本笔记将深入探讨 Hibernate 的核心概念、配置、实体映射、查询语言及缓存机制。 1. **核心概念** - **对象关系映射(ORM)**: Hibernate 提供了一种桥梁,将 Java 对象与数据库中的记录关联起来,使得开发者可以...

    J2EE三大框架_笔记_a

    23-26Hibernate数据关联技术笔记 27-32Hibernate数据关联技术_1vs1应用案例_笔记 33-37Hibernate1对N案例笔记 38-43Hibernate多对多案例笔记 J2EE框架_笔记_c: 44登陆案例(Struts+DAO+Hibernate)笔记 45-...

    hibernate-note学习笔记

    ### hibernate-note学习笔记知识点详解 #### 一、对象持久化 **1.1 概述** 对象持久化是指将程序中的对象状态保存到非易失性存储中(如硬盘或磁盘等),以便在系统重启后仍能保留这些状态。这种技术常用于将对象的...

    韩顺平Hibernate笔记

    7. **缓存机制**:介绍Hibernate的缓存层次结构,包括一级缓存(Session缓存)和二级缓存,以及第三方缓存插件如 EhCache 的集成。 8. **性能优化**:讨论如何优化Hibernate的性能,如批处理、延迟加载策略、查询...

    Hibernate3 学习笔记.ppt

    【三、Hibernate映射申明(Mapping declaration)】 Hibernate映射声明通常通过XML文件(*.hbm.xml)或注解实现。XML文件中包含了类与表的详细映射信息,包括属性类型、长度、主键设置等。注解方式则更简洁,可以...

    马士兵hibernate学习笔记(原版)

    7. **性能优化**:Hibernate的性能优化主要包括缓存机制(第一级缓存、第二级缓存)、批处理、延迟加载等策略,通过合理设置和使用,可以显著提高应用程序的运行效率。 8. **Annotation与XML配置**:Hibernate支持...

    韩顺平hibernate笔记

    【hibernate笔记】 在Java世界中,Hibernate是一款强大的对象关系映射(ORM)框架,它简化了数据库操作,使得开发者可以使用面向对象的方式处理数据。韩顺平老师的hibernate笔记,是针对他视频教程的配套学习资料,...

    [Java学习笔记doc]Hibernate学习教程和笔记

    【Java学习笔记doc】Hibernate学习教程和笔记 Hibernate是一个开源的对象关系映射(ORM)框架,它极大地简化了Java开发者与数据库之间的交互。这个文档集合是针对Java初学者和进阶者的一份宝贵资料,旨在深入理解...

    hibernate五天学习笔记(txt)

    Hibernate提供了第一级缓存和第二级缓存,可以显著提高应用性能。我们还会学习如何处理并发问题,如乐观锁和悲观锁的使用,以及事务的管理,包括@Transactional注解的使用和事务的隔离级别。 此外,笔记可能还会...

    Hibernate全部笔记

    **Hibernate 全部笔记** Hibernate 是一款开源的Java平台上的对象关系映射(ORM)框架,它极大地简化了数据库操作,使得开发人员可以使用面向对象的方式来处理数据库事务。本笔记将深入探讨Hibernate的核心概念、...

    Hibernate笔记

    ### Hibernate笔记 #### 一、概述 Hibernate 是一个开源的对象关系映射(ORM)框架,它简化了Java应用程序与数据库之间的交互过程。通过使用Hibernate,开发者可以将对象模型与关系型数据库模型进行映射,从而避免...

    Java相关课程系列笔记之十四Hibernate学习笔记

    【Java相关课程系列笔记之十四Hibernate学习笔记】 Hibernate是一个开源的对象关系映射(ORM)框架,它极大地简化了Java应用程序对数据库的操作。本笔记将详细阐述Hibernate的核心概念、使用方法和特性。 一、...

    hibernate API帮助文档 及hibernate学习笔记

    - 第二级缓存:SessionFactory级别的缓存,可以跨Session共享,常使用第三方缓存提供商如Ehcache。 - 查询缓存:存储查询结果,避免重复执行相同的查询。 6. ** Hibenate学习笔记** - 笔记可能涵盖了实际开发中...

    黑马程序员_hibernate框架开发2016版讲义和笔记资料_day1_day2_day3_day4

    5.1 第二级缓存:利用Hibernate的二级缓存提高性能,例如使用EHCache或Infinispan。 5.2 lazy loading:延迟加载策略,只在真正需要时加载关联对象,避免内存消耗过大。 5.3 分页查询:使用Criteria的...

    hibernate学习笔记文档

    ### Hibernate 学习笔记知识点概览 #### 一、Hibernate 概述 - **定义**:Hibernate 是一款开源的对象关系映射(ORM)框架,它实现了将 Java 应用程序中的对象模型映射到关系型数据库中的记录。通过 ORM 技术,...

Global site tag (gtag.js) - Google Analytics