Note that there are some explanatory texts on larger screens.

plurals
  1. POMigrating Spring application from Postgres to Oracle: defining table's schema
    text
    copied!<p><strong>FINAL EDIT</strong></p> <p>The reason why I didn't see any logs is that I was using an old version of log4j. Hibernate hbm2ddl uses slf4j for logging and so all the logs were ignored by log4j 1. Now I upgraded to log4j2 that has a slf4j bridge and I see all the errors in the log.</p> <p>Godd new is that from here I can pick the conversion errors one by one and fix them, bad news (for me) is that they are a lot!</p> <p>Thanks to everyone!</p> <p><strong>FINAL EDIT END</strong></p> <p>I've a very complex java7+Spring3.2.0+hibernate3 web application that works with a Postgresql database. A client now imposed as requirement to use Oracle as a database for a project. I'm having trouble figuring out the Schema use in Oracle.</p> <p>The Postgresql database is divided in about 10 different schemas, plus separated schemas for the audit records. I define tables and schemas in the annotation. I.e.:</p> <pre><code>@Entity @Table(name = "language", schema = "live") @Audited @AuditTable(value="language_aud", schema="live_aud") public class Language implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Integer id; etc... </code></pre> <p>This works quite well in Postgres. To create the database I create manually the schemas first:</p> <pre><code>CREATE SCHEMA live; </code></pre> <p>And then start the application with hibernate.hbm2ddl.auto=create. This works like a charm and the database is correctly built.</p> <p>Now moving to Oracle I have problems with the schema definition. I tried the CREATE SCHEMA statement with no succes but then found out that in Oracle schema=user (very strange to me but there must be a reason). So I created all the users to match the Schema structure. I.e.:</p> <pre><code>CREATE USER live IDENTIFIED BY 'password'; </code></pre> <p>** EDIT **</p> <p>But this still doesn't work, when I run the application the tables are not created by hibernate (I fixed the previous exception adding try/catch to postProcess methods, they failed as the database was not created)</p> <p>I can get the connection correctly with Oracle, I use the parameter:</p> <pre><code>jdbc.driver=oracle.jdbc.driver jdbc.url=jdbc:oracle:thin:@//localhost:1521/XE jdbc.username=system jdbc.password='password' hibernate.dialect=org.hibernate.dialect.Oracle10gDialect </code></pre> <p>What I am doing wrong? do I have to create the schemas in a different way? or is the system user not to have the right privileges?</p> <p>The application is shared by many clients so a requirement I have is to try to avoid to change completely the structure removing the schemas. In a perfect world the application should be database indipendant so work with any database.</p> <p>Thank you for any help you can give and please ask if you need more info.</p> <p>Mattia</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload