java - Hibernate doesn't include schema into query -


this question has answer here:

according configuration, hibernate dao repository should send query this:

insert some_schema.some_table (...) values (...) 

instead, hibernate sends this:

insert some_table (...) values (...) 

it omits schema prefix. without prefix getting ora-00942, table not exist oracle database error. how force hibernate send schema prefix?

p.s. question similar this question, adding default schema doesn't work me, because using more of them.

configuration of entity this:

<hibernate-mapping> <class name="com.somepackage.someclass" table="some_table" schema="some_schema">   <id name="someid" type="int" column="some_table_id">      <generator class="increment"/>   </id>   <property name="someprop" column="some_prop" type="string"/> </class> </hibernate-mapping> 

hibernate config:

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd     http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">  <!-- oracle data source definition --> <bean id="oracledatasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource">     <property name="driverclassname"><value>${oracle.database.driverclassname}</value></property>     <property name="url"><value>${oracle.database.url}</value></property>     <property name="username"><value>${oracle.database.username}</value></property>     <property name="password"><value>${oracle.database.password}</value></property> </bean>  <bean id="sessionfactory" class="org.springframework.orm.hibernate3.localsessionfactorybean">     <property name="datasource" ref="oracledatasource" />     <property name="mappingresources">         <list>             <value>some-table.cfg.xml</value>         </list>     </property>     <property name="hibernateproperties">         <props>             <prop key="hibernate.dialect">org.hibernate.dialect.oracle10gdialect</prop>             <prop key="hibernate.show_sql">true</prop>             <prop key="hibernate.current_session_context_class">thread</prop>         </props>     </property> </bean> 

add below in hibernate properties. should automatically picked. have same , works

<property name="hibernate.default_schema" value="myschema"/> 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -