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
|