users@glassfish.java.net

RE: Glassfish V3 usage with Oracle DB and more than one schema (user)

From: Narayana Rallabandi <narayana.rallabandi_at_oracle.com>
Date: Mon, 16 Jul 2012 02:04:30 -0700 (PDT)

Hi,

 

Did you ask your DB system admin for making this table/view visible for the user who is accessing it?

 

Regards,

 

From: Redelin, Sven [mailto:Sven.Redelin_at_ottogroup.com]
Sent: Monday, July 16, 2012 2:18 PM
To: users_at_glassfish.java.net
Subject: Glassfish V3 usage with Oracle DB and more than one schema (user)

 

Dear Sir and Madam,

I've got a big Problem with the usage of glassfish and don't know if it's a bug or a configuration mistake.

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 you 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>

 

___________________________________________________________________   

    

Sven Redelin

Otto Group · Group Technology Partner (GTP)

Business Analyst Direktversand · Zentrale Logistik · FI-IS-LO-ZL

sven.redelin_at_ottogroup.com

 

Otto (GmbH & Co KG) · Wandsbeker Straße 3-7 · 22172 Hamburg   

Telefon +49 40 64616116 · Telefax +49 40 64646116

___________________________________________________________________   

 

Besuchen Sie uns auf:

Karriere machen:

ottogroup.com

ottogroup.com/karriere

___________________________________________________________________

 

AG Hamburg, HR A 62 024, Persönlich haftend: Verwaltungsgesellschaft Otto mbH,   

Hamburg, AG Hamburg, HR B 13 762 vertr. durch: Hans-Otto Schrader (Vorsitzender) ·   

Dr. Rainer Hillebrand (Stellvertretender Vorsitzender) · Alexander Birken · Dr. Michael   

Heller · Dr. Timm Homann · Hanjo Schneider · Jürgen Schulte-Laggenbeck · Dr. Winfried   

Zimmermann   

Aufsichtsrat: Dr. Michael Otto (Vorsitzender)  

___________________________________________________________________

    

SAVE PAPER - THINK BEFORE YOU PRINT