dao표 최적화
1807 단어 DAO
// ticket hql
String hql = "select new Ticket(id,name,address,activeDate,saleBeginTime,saleEndTime,thumbnail,pic,enteringman,enteringdate,status,datasource) from "+table+" where status = ' ' order by "+orderby+" "+desc;
ticket
public Ticket(Integer id, String name, String address, String activeDate, Object saleBeginTime, Object saleEndTime,
String thumbnail, String pic, String enteringman,
Object enteringdate, String status, String datasource) {
super();
this.id = id;
this.name = name;
this.address = address;
this.activeDate = activeDate;
this.saleBeginTime = stringToTimestamp(saleBeginTime.toString());
this.saleEndTime = stringToTimestamp(saleEndTime.toString());
this.thumbnail = thumbnail;
this.pic = pic;
this.enteringman = enteringman;
this.enteringdate = stringToTimestamp(enteringdate.toString());
this.status = status;
this.datasource = datasource;
}
// Property accessors
/**
* Timestamp
* @param dateStr
* @return
*/
public static Timestamp stringToTimestamp(String dateStr){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
try {
Date date = sdf.parse(dateStr);
date.getTime();
cal.setTime(date);
return new Timestamp(cal.getTimeInMillis());
} catch (ParseException e) {
e.printStackTrace();
}
cal.setTime(new Date());
return new Timestamp(cal.getTimeInMillis());
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Spring에서 DAO가 순환 호출될 때 데이터가 실시간으로 업데이트되지 않는 해결 방법문제를 설명하기 전에 몇 가지 전제 사항을 설명하십시오. Spring의 구성 파일에서 다음과 같은 방식으로 데이터베이스 트랜잭션을 구성했다고 가정하십시오. 현재 UserDao 및 Security Service가 있습...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.