-->
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.  [ 3 posts ] 
Author Message
 Post subject: ORA-04043 Error when insert via synonym using OCI driver
PostPosted: Wed May 16, 2007 12:21 am 
Newbie

Joined: Tue May 15, 2007 11:50 pm
Posts: 2
Does anyone know hibernate support insert statement via synonym using OCI driver?

The situation is this:

Database:
Code:
- AUDIT_LOG table is created in "reporting" schema with sequence and trigger for generating primary key
- A synonym called AUDIT_LOG is created in "application" schema and it links to AUDIT_LOG table in "reporting" schema
- Grant insert AUDIT_LOG table in "reporting" schema to user


Application:
Code:
- Use Oracle 10g OCI driver with hibernate 3.2 in spring 2.0
- Customize the Oracle9Dialect to use sequence and trigger to generate primary key
- Use HibernateTemplate.save(obj) method to insert the object  to application.AUDIT_LOG


Error:
Code:
java.sql.SQLException: ORA-04043: object AUDIT_LOG does not exist
   at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
   at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:676)
   at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:602)
   at oracle.jdbc.driver.T2CConnection.doDescribeTable(T2CConnection.java:3028)
   at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3465)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.hibernate.util.NamedGeneratedKeysHelper.prepareStatement(NamedGeneratedKeysHelper.java:42)
   at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:490)
   at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:109)
   at org.hibernate.id.SequenceIdentityGenerator$Delegate.prepare(SequenceIdentityGenerator.java:76)
   at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:30)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2044)
   at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2481)
   at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:47)
   at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
   at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
   at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
   at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:186)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:175)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:98)
   at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
   at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:509)
   at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:501)
   at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:497)
   at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:679)
   at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362)
   at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:676)

Other tests have been done:
Code:
- The above scenario works with thin driver
- OCI driver works for select statement using HibernateTemplate.find(obj)


Can anyone also clarify that is there any RAC features that are not supported in Hibernate?
e.g. Using oci for Oracle RAC failover and load balancing

Thanks in advance!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 16, 2007 1:19 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Hi,
>>> Does anyone know hibernate support insert statement via synonym using OCI driver?

The underlying entity, be it synonym / table / view is transparent to Hibernate.
So, it is possible.
I tested it writing a simple application. It works fine.

Can you get the query generated by Hibernate and fire it to database directly.
This is just to verify that the required objects and privileges are really in place.

--------------------------------------------------
Rate the reply if you find it helpful


Top
 Profile  
 
 Post subject: Works with session.createSQLQuery
PostPosted: Tue Jun 05, 2007 1:25 am 
Newbie

Joined: Tue May 15, 2007 11:50 pm
Posts: 2
I have tried using sql in session.createSQLQuery, it works fine.
Code:
session.createSQLQuery("insert into AUDIT_LOG (WHEN_OCCURRED, EVENT_TYPE_DBID, INITIATING_USER, CORRELATION_ID, ARG_5, ARG_6, ARG_7, ARG_8, ARG_9) values ((to_date('2003/05/03 21:02:44', 'yyyy/mm/dd hh24:mi:ss')), 'test', 'test', null, null, null, null, null, null)").executeUpdate();

Any idea why it does not work with session.save() method?
Is it because of the custom Dialect?


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.