JPA配置左连接
model层:
?@Id
?@GeneratedValue(strategy = GenerationType.IDENTITY)
?private Integer id???????? ;??????
?private Integer client_type;??????
???????????????????????????????????
?private String versionid?? ;??????
?private String down_url??? ;??????
???????????????????????????????????
?private Timestamp addtime? ;
? @ManyToOne
? @JoinColumn(name="client_type",updatable = false,insertable = false)
??? private CntvClientServer cntvClientServer;
?
?
?@Transient
?private String servername;//临时字符串?
?
?public CntvSoftVersion(){}
?
?public CntvSoftVersion(CntvSoftVersion cn,String servername){
??super();
??this.id=cn.getId();
??this.client_type=cn.getClient_type();
??this.versionid=cn.getVersionid();
??this.down_url=cn.getDown_url();
??this.addtime=cn.getAddtime();
??
??this.servername=servername;?
?
??
?}
dto层:
StringBuffer hql_sb = new StringBuffer(" select new CntvSoftVersion(a,b.servername) from CntvSoftVersion a left join a.cntvClientServer b? where 1=1 ");