-->
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: Some questions about Hibernate
PostPosted: Sat Aug 18, 2007 2:57 pm 
Newbie

Joined: Sat Aug 18, 2007 2:33 pm
Posts: 2
Hi,

I'm using Hibernate 3.2.4 with Oracle 10g and postgess 8.03 under Jboss.

Here are some issues I need help:

1. session.update(Object) and session.delete(Object) do not reurn the number of changed rows nor throw exception if the Object does not exist in the database.
It is important in our appliaction to know if the user was trying to update/delete a non exitent opbject.
Using this two methods will not let us know this information.
Do Hibernate team have an intention to add variation for the update/delete methods that will give the caller a clue about the result?

2. Does the best solution for my requirment(1), using the current code, is doing :
object = session.get(classz, id);
if ( object!= null )
session.delete(object)/update(object)
else
throw new Exception(......)


3.In our application the following scenario may ooccure in the same session/transaction:
session.save(object);
object.setXXX(); // or session.update(object)
session.delete(object);

I've noticed, according to the Hibernate logs, that in that case the update command is ignored, as part of the optimization.
Usually this is ok, but on our application the update may fire a trigger, which will not occure with this optimization.

Does the only way to force the update is calling session.flush(), after the second line?

4. General question concerning session.flush(): Is it considered bad practice to call this method during the session ( and not just at the of the tranaction) or I can use it as much as I want to force Hibernate to update the database in the exact order it appears in the code, bypassing the Hinernate optimization?

5. In the Hibernate.cfg.xml I'm using the org.hibernate.dialect.OracleDialect.

I've a problem the mapping of timestamp field when dealing with Oracle databse. The problem does not appear when dealing with Postgres database.

For the Oracle databse, the timestamp field is mapped to Date column in the database instead of the expected timestamp.
When I'm using Postgress I get the expected Timstamp column.
What is the reason for this strange behavior in Oracle?

Thanks,
Eitan Ben-Noach


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.