摘要
環境
說明
一
/**
* @author leizhimin
* @hibernate
* ta attribute=
* @hibernate
*/
public class WorkNote {
private Long id; //標識
private Date workDate; //日期
private String weather; //天氣
private String content; //日志內容(Clob)
private String state; //日志狀態
private Long orgId; //機構id
private Long userId; //用戶id
private Date createDate; //創建日期
private byte[] image; //圖片
public static final String WORKNOTE_BLANK =
public static final String WORKNOTE_FULL =
/**
* @hibernate
* ta attribute=
* @hibernate
*/
public Long getId() {
return id;
}
public void setId(Long id) {
this
}
/**
* @hibernate
* ta attribute=
*/
public Date getWorkDate() {
return workDate;
}
public void setWorkDate(Date workDate) {
this
}
/**
* @hibernate
* ta attribute=
*/
public String getWeather() {
return weather;
}
public void setWeather(String weather) {
this
}
/**
* @hibernate
* ta attribute=
*/
public String getContent() {
return content;
}
public void setContent(String content) {
ntent = content;
}
/**
* @hibernate
* ta attribute=
*/
public String getState() {
return state;
}
public void setState(String state) {
this
}
/**
* @hibernate
* ta attribute=
*/
public Long getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
Id = orgId;
}
/**
* @hibernate
* ta attribute=
*/
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this
}
/**
* @hibernate
* ta attribute=
*/
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this
}
/**
* @hibernate
* ta attribute=
*/
public byte[] getImage() {
return image;
}
public void setImage(byte[] image) {
this
}
}
二
<?xml version=
<!DOCTYPE hibernate
<hibernate
default
>
<class
name=
table=
>
<meta attribute=
<id
name=
column=
type=
>
<meta attribute=
<generator class=
<param name=
<!
To add non XDoclet generator parameters
hibernate
containing the additional parameters and place it in your merge dir
</generator>
</id>
<property
name=
type=
update=
insert=
column=
not
>
<meta attribute=
</property>
<property
name=
type=
update=
insert=
column=
length=
not
>
<meta attribute=
</property>
<property
name=
type=
update=
insert=
column=
not
>
<meta attribute=
</property>
<property
name=
type=
update=
insert=
column=
length=
not
>
<meta attribute=
</property>
<property
name=
type=
update=
insert=
column=
>
<meta attribute=
</property>
<property
name=
type=
update=
insert=
column=
>
<meta attribute=
</property>
<property
name=
type=
update=
insert=
column=
not
>
<meta attribute=
</property>
<property
name=
type=
update=
insert=
column=
not
>
<meta attribute=
</property>
<!
To add non XDoclet property mappings
hibernate
containing the additional properties and place it in your merge dir
</class>
</hibernate
三
drop table rc_gzrz cascade constraints;
create table rc_gzrz (
BS number(
workDate timestamp
weather varchar
content clob
state varchar
orgId number(
userId number(
createDate timestamp
image blob
primary key (BS)
);
comment on table rc_gzrz is
comment on column rc_gzrz
comment on column rc_gzrz
comment on column rc_gzrz
comment on column ntent is
comment on column rc_gzrz
comment on column Id is
comment on column rc_gzrz
comment on column rc_gzrz
comment on column rc_gzrz
四
/**
* Created by IntelliJ IDEA
* User: leizhimin
* Date:
* Time:
* To change this template use File | Settings | File Templates
*/
public interface WorkNoteDAO extends CommonDAO {
/**
* 根據日期查詢工作日志
*
* @param workDate 工作日期
* @param userId 用戶id
* @param orgId 機構id
* @param sp 分頁對象
* @return List
*/
public List findWorkNoteByDate(Date workDate
/**
* 根據狀態查詢工作日志
*
* @param state 日志狀態
* @param userId 用戶id
* @param orgId 機構id
* @param sp 分頁對象
* @return List
*/
public List findWorkNoteByState(String state
}
/**
* Created by IntelliJ IDEA
* User: leizhimin
* Date:
* Time:
* To change this template use File | Settings | File Templates
*/
public class WorkNoteDAOImpl extends CommonDAOImpl implements WorkNoteDAO{
public List findWorkNoteByDate(Date workDate
return null;
}
public List findWorkNoteByState(String state
return null;
}
}
五
/**
* Created by IntelliJ IDEA
* User: leizhimin
* Date:
* Time:
* To change this template use File | Settings | File Templates
*/
public interface OfficeService {
public void saveWorkNote(WorkNote workNote);
public void updateWorkNote(WorkNote workNote);
}
/**
* Created by IntelliJ IDEA
* User: leizhimin
* Date:
* Time:
* To change this template use File | Settings | File Templates
*/
public class OfficeServiceImpl implements OfficeService{
private WorkNoteDAO workNoteDAO;
public WorkNoteDAO getWorkNoteDAO() {
return workNoteDAO;
}
public void setWorkNoteDAO(WorkNoteDAO workNoteDAO) {
this
}
public void saveWorkNote(WorkNote workNote) {
this
}
public void updateWorkNote(WorkNote workNote) {
this
}
}
六
/**
* Created by IntelliJ IDEA
* User: leizhimin
* Date:
* Time:
* To change this template use File | Settings | File Templates
*/
public class TestOffice extends TestCase {
public void test_worknote_save(){
OfficeService officeService = (OfficeService) ContextHelper
WorkNote workNote=new WorkNote();
workNote
workNote
workNote
byte[] b=
workNote
officeService
}
}
看看測試結果
From:http://tw.wingwit.com/Article/program/Java/ky/201311/27913.html