java - Hibernate: how to extract the time part -


just want insert time part in data base using hibernate ....

what trying .....

public static void main(string[] args) {     calendar cal = calendar.getinstance();     userid ui = new userid();     compkeyclass ckc1=new compkeyclass();     ckc1.setage(21);     ckc1.setuserid(ui);     ui.setdeptno("1002");     ckc1.setcal1(cal.gettime());             ......  @id private userid userid; @sequencegenerator(name="myseqgen",sequencename="employeehib") @generatedvalue(generator="myseqgen") private char man='a'; @temporal(temporaltype.timestamp) private date hiredate; @temporal(temporaltype.time) private date timedate; @temporal(temporaltype.date) private date datedate; @temporal(temporaltype.date) private date cal1; @temporal(temporaltype.time) 

but here when calling gettime method showing date .

is there way show time part....

int hours = cal.get(calendar.hour_of_day); int minutes = cal.get(calendar.minute); int seconds = cal.get(calendar.second); 

or

simpledateformat dateformatter = new simpledateformat("hh:mm:ss"); string time = dateformatter.format(cal.gettime()); 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -