Need help with Hibernate? Read this first: We have an application DB (oracle9i) and a Reporting DB (oracle9i). A standalone projects feeds data from Application DB to the Reporting DB using Hibernate 2.0. Following way it happens....if there is an insert or update operation happening in te application DB a truigger with populate a eventout table and the Java program will pick up the unique key from the eventout table and update the records in Reporting...The problem we see is that the date time fields are getting mismatched. PLease help
thanks.
http://www.hibernate.org/ForumMailingli ... AskForHelp
[b]Hibernate version:[/b] 2.0
[b]Mapping documents:[/b] hbm
[b]Code between sessionFactory.openSession() and session.close():[/b] Session RDBsess = RDBsessions.openSession();
Transaction tx = null;
ServiceResponse service_response = null;
String eventType = eventout.getEVTYPE();
Object obj = null;
String rdbSql = "";
boolean deleteRecord = false;
Date startdt = new Date();
Date enddt = new Date();
long elapsedtime;
// message set to warn temporarily to debug an issue.
logger.warn("RDB Starting to Process Event: " + eventout.getEVSYSSEQ() + ": " + eventout.getEVTYPE());
try{
if (eventout.getEVSYSOPT() != null && eventout.getEVSYSOPT().equals("delete"))
{
deleteRecord = true;
}
else
{
deleteRecord = false;
}
//startdt = new Date();
// ---------- Update Problem tables -------------- //
if (eventType.equals("uisRdbProbsummarya1")){
Probsummarya1 psa1 = new Probsummarya1(eventout.getUIS_KEY1(),new BigDecimal(eventout.getUIS_KEY2()));
if (!deleteRecord){
obj = SCsess.load(Probsummarya1.class,psa1);
rdbSql = "select count(*) from Probsummarya1 tbl where tbl.numberprgn='"+eventout.getUIS_KEY1()+"' and tbl.recordNumber="+eventout.getUIS_KEY2();
}else{
obj = psa1;
}
......
try{
tx = RDBsess.beginTransaction();
if (deleteRecord)
{
RDBsess.delete(obj);
}
else
{
logger.debug("RDB SQL: " + rdbSql);
Integer count = (Integer) RDBsess.createQuery(rdbSql).uniqueResult();
if (count.intValue() > 0)
{
RDBsess.update(obj);
logger.debug("Record value: " + obj.toString());
}
if (count.intValue() == 0)
{
RDBsess.save(obj);
}
}
//tx.commit();
RDBsess.flush();
RDBsess.close();
[b]Full stack trace of any exception that occurs:[/b]
[b]Name and version of the database you are using:[/b]
[b]The generated SQL (show_sql=true):[/b]
[b]Debug level Hibernate log excerpt:[/b]
Problems with Session and transaction handling?
Read this:
http://hibernate.org/42.html