Skip to main content

Did glassfish provide DB access to different schema with Oracle DB?

No replies
sredelin
Offline
Joined: 2012-07-16
Points: 0

Dear all,
I've got a big Problem with the usage of glassfish.
For our business software we use actually the weblogic application server.
We want to switch to glassfish V3.
Now I check local for ToDos.

my JNDI - DataSource Connection has been established and together with the correct *.dbschema-File I'am able to deploy.
All SessionBeans with connection to the database are working fine.
My Problem are the EntityBeans.

From my point of view the problem ist, that my DBUser is different to the Schema-User.
The result of performing a function ist this stack trace:

[#|2012-07-16T09:36:47.117+0200|WARNING|glassfish3.1.2|javax.enterprise.system.container.ejb.entity.finder|_ThreadID=79;_ThreadName=Thread-2;|JDO74004: Bean 'InfoUpdateBean' Methode ejbFindByPrimaryKey:
com.sun.jdo.api.persistence.support.JDODataStoreException: JDO76400: JDBC-SQLException beim Ausführen der SQL-Anweisung:
SQL-Anweisung<select t0."AUTO_KEY", t0."FIKT_LIEF_NR", t0."INFOTEXT_NR", t0."ANZEIGEN_KZ", t0."GELADEN_AM", t0."LETZTE_AKTUALISIERUNG", t0."BENUTZER_ID" from "LIS_ZUORDNUNG" t0 where t0."AUTO_KEY" = ?> mit Eingabewerten:java.lang.Long:1159049.
Weitere Informationen finden Sie in der SQLException.
NestedException: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist

So the Problem is, that the table "LIS_ZUORDNUNG" doesn't exist at the point of view from the current User.
The SQL has to include a pretended schema name like NDA."LIS_ZUORDNUNG".
Then the SQL works fine inside the SQL Developer...

Can anybody help me? Google isn't my friend in this case :/
Thanks
Sven

My additional configuration-files are:
sun-cmp-mappings.xml => SchemaFile named "NDA.dbschema"

<?xml version="1.0"?>
<!DOCTYPE sun-cmp-mappings PUBLIC '-//Sun Microsystems, Inc.//DTD Sun ONE Application Server 7 OR Mapping //EN' 'http://www.sun.com/software/sunone/appserver/dtds/sun-cmp_mapping_1_0.dtd'>
<sun-cmp-mappings>
<sun-cmp-mapping>
<schema>NDA</schema>
<entity-mapping>
<ejb-name>InfoUpdateBean</ejb-name>
<table-name>LIS_ZUORDNUNG</table-name>
<cmp-field-mapping>
<field-name>autoKey</field-name>
<column-name>AUTO_KEY</column-name>
</cmp-field-mapping>
...
</entity-mapping>
</sun-cmp-mapping>
</sun-cmp-mappings>

ejb-jar.xml

<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <description>no description</description>
   <enterprise-beans>
<entity>
      <ejb-name>InfoUpdateBean</ejb-name>
      <home>com.test.ejb.InfoUpdateHome</home>
        <remote>com.test.ejb.InfoUpdate</remote>
        <ejb-class>com.test.ejb.InfoUpdateBean</ejb-class>
        <persistence-type>Container</persistence-type>
        <prim-key-class>java.lang.Long</prim-key-class>
        <reentrant>False</reentrant>
        <abstract-schema-name>InfoUpdateBean</abstract-schema-name>
         <cmp-field><field-name>autoKey</field-name></cmp-field>
         <cmp-field><field-name>fiktLiefNr</field-name></cmp-field>
         <cmp-field><field-name>infoTextNr</field-name></cmp-field>
         <cmp-field><field-name>anzeigenKz</field-name></cmp-field>
         <cmp-field><field-name>geladenAm</field-name></cmp-field>
         <cmp-field><field-name>letzteAktualisierung</field-name></cmp-field>
         <cmp-field><field-name>benutzerID</field-name></cmp-field>
         <primkey-field>autoKey</primkey-field>
         <resource-ref>
            <res-ref-name>jdbc/WsiDataSource</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
         </resource-ref>
      </entity>
</enterprise-beans>
</ejb-jar>

glassfish-ejb-jar.xml

<glassfish-ejb-jar>
<enterprise-beans>
<ejb>
<ejb-name>InfoUpdateBean</ejb-name>
<jndi-name>com.otto.wsi.ejb.InfoUpdateHome</jndi-name>
</ejb>
</enterprise-beans>
</glassfish-ejb-jar>