hibernate - Oracle JDBC connecting to the wrong user -


i'm using hibernate(3.6.9.final) , oracle 11g databse jdbc(ojdbc6:oracle.jdbc.oracledriver) connection string jdbc:oracle:thin:@servername:1521:orcl datasource: com.mchange.v2.c3p0.combopooleddatasource

ioc:spring 3.0.7.release

server: tomcat 6

the description of problem is: have 2 schemas(users) defined in oracle server my_sc , my_old_sc, my_old_sc represents older schema of application , has table my_table 1 column name my_id my_sc latest schema of application , has my_table in addition my_id column has my_name column

when start application my_sc user , hibernate on validate fail on following exception:

org.hibernate.hibernateexception: missing column: my_name in my_old_sc.my_table

it seems connects wrong schema though verified connect my_sc user, after drop my_old_sc database i'm able connect my_sc.

this issue not consistent i'm able work different schams, when fails once must drop schemas in database except 1 want use. of times happens after use impdp of new schema, not not after impdp

please note if connect sql developper connection user seems correct.

statement creating users:

create user username identified username        default tablespace users          temporary tablespace temp        quota unlimited on users;   grant conn username; 

code impdb:

./impdp system/pass@orcl remap_schema=org_name:new_name directory=data_pump_dir transform=oid:n dumpfile=backup.dmp 

will great if you'll know might problem, maybe need create user differently? cause issue?

thanks in advence

i had problem hibernate 3.3.0. basically, hibernate database metadata scanner runs during validation pick table matches entity's definition regardless of schema comes long has read access table definition (not read access table itself). gets them in alphabetical order if entity table widget , target schema my_app_schema there's widget in another_apps_schema, 1 another_apps_schema used hibernate validate entity.

i wasn't able find official on hibernate's site did find similar posts here , here.

you may able use hibernate.default_schema set schema hibernate use.


Comments