Expert |
|
Joined: Thu May 26, 2005 9:19 am Posts: 262 Location: Oak Creek, WI
|
Hi,
I suppose the object you pass into the method is an activeAlarm. So you need to clone the object to HistoricalAlarm and viceversa.
If you get different objects of Alarm in the runtime. Do an instanceof check to prevent from ClassCastException
i.e)
public void addAlarms(Alarm alarm) {
if(alarm instanceof HistoricalAlarm){
HistoricalAlarm halarm = (HistoricalAlarm)alarm;
getHibernateTemplate().save(halarm);
}else{
// place your activealarm here
}
}
All the Best
_________________ RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.
|
|