-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Date/Time mismatch occuring when updating via Hibernate
PostPosted: Wed Jan 30, 2008 7:02 am 
Newbie

Joined: Wed Jan 30, 2008 6:24 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.