Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Re: OC4J Tricks - Ramifications?

Hi Tim,
if you are using OC4J I assume you have access to "My Oracle Support".
Here you can find
Doc Id 781955.1 - How to Use EclipseLink Instead of TopLink Essentials as the EJB 3.0 Java Persistence Provider of Oracle Application Server

My experience is that a JPA provider loaded with the web module class loader does not work in a EJB 3.0 container that requires the provider classes further up the class loading hierarchy. Maybe this note will make your application server admins to create an appropriate shared library.

Regards,
Reinhard Girstenbrei****

eclipselink-users-request@xxxxxxxxxxx wrote:
Send eclipselink-users mailing list submissions to
	eclipselink-users@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
	https://dev.eclipse.org/mailman/listinfo/eclipselink-users
or, via email, send a message with subject or body 'help' to
	eclipselink-users-request@xxxxxxxxxxx

You can reach the person managing the list at
	eclipselink-users-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of eclipselink-users digest..."


Today's Topics:

   1. Re: OC4J Tricks - Ramifications? (Tim Hollosy)
   2. Re: multible fetch joins (Gordon Yorke)
   3. Re: multible fetch joins (Tom Ware)
   4. Cannot set Factory Instantiation policy with	Weaving Enabled
      (Mark Robinson)
   5. Re: Use an entity as a discriminator column (bea)


----------------------------------------------------------------------

Message: 1
Date: Tue, 1 Dec 2009 13:23:29 -0500
From: Tim Hollosy <hollosyt@xxxxxxxxx>
Subject: Re: [eclipselink-users] OC4J Tricks - Ramifications?
To: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Message-ID:
	<cedabbb70912011023h1571fbf4q900318526998b808@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

Micahel, my issue is this:

If I put the data source & provider tags in my persistence.xml then
OC4J has class loading issues, which I assume is because I'm using a
user lib in my war for eclipselink.jar and the persistence.jar rather
than a shared server lib, so it tries to start up the persistence
layer before my app's WEB-INF/lib is loaded, resulting in no class def
issues on entities. That option is out to me, as I'll have a hard time
convincing the server admins to rearrange things for me.

I tried to set my transaction type to RESOURCE_LOCAL and removed my
orion-application.xml from the ear but OC4J still tried to use the
default data source.

My goal:
Deploy to vanilla OC4J without having to define a data source on the
server that ultimately is never used. I can live with the work around
of defining a data source or default data source, just to make the
OC4J Deploy happy, but it seems wasteful.

I suppose I could change my spring app to use a JNDI data source, but
then I'd have some issues deploying to WTP's J2EE Preview Jetty Server
locally.

./tch



On Tue, Dec 1, 2009 at 12:46 PM, Michael O'Brien
<michael.obrien@xxxxxxxxxx> wrote:
Tim,
    Try a non-jta-data-source if you need a DS that is not transactional.
    Switch from transaction-type JTA to RESOURCE_LOCAL (usually only in SE)
- in that case it will not be managed by the server, you will need your own
javax.persistence.jdbc.* properties and will not be using the server's
connection pool.  Sounds like you are in a similar situation as most Tomcat
users and want to run in partial SE mode on the server.
    thank you
    /michael

Tim Hollosy wrote:

Thanks Michael,
So is there some setting to force OC4J to not try to use a data source
for an app? I find it silly that I have to define a datasource for my
app in the orion-application.xml even though I'm not using a JNDI data
source. The wiki page says to override the OracleDS, but obviously
this doesn't work in a production environment with multiple apps
deployed on the same server.

./tch



On Tue, Dec 1, 2009 at 10:23 AM, Michael O'Brien
<michael.obrien@xxxxxxxxxx> wrote:


Tim,
  Thank you for the end to end verification of EclipseLink EAR deployment on
OC4J that includes Spring - the details of your issues are very useful.
  There is a repository of info that may be of interest on the OC4J tutorial
(updated for 10.1.3.5) for EclipseLink JPA EE applications that detail some
scenarios around the default OracleDS JTA datasource, overriding the
essentials provider with EclipseLink and integration with the Eclipse EE IDE
server pluggin which handles the custom orion descriptor for the developer -
in the case of the simple tutorial app that uses the default OracleDS - one
is not required yet.
  A non-jta and application managed DS section would be beneficial.
  http://wiki.eclipse.org/EclipseLink/Examples/JPA/OC4J_Web_Tutorial

  /michael
  http://www.eclipselink.org

Tim Hollosy wrote:


I've been playing around with OC4J Deploys, my goal is to deploy into
a vanilla OC4J Instance. I'm posting how I did it for people who may
be struggling with the same issues, and also to get a  sanity check
from the Oracle people.

My app uses Spring's Transaction manager and a c3p0 data source,
defined in my app context.xml, an eclipselink.jar and persistance.jar
in my /WEB-INF/lib.

Anyway on OC4J 10.1.3.5.0 Here are the Issues I ran into.

Initial deploy, my ear file does not contain an orion-application.xml,
persistence.xml does not specificially reference eclipselink as the
JPA provider.

Deploy fails, when OC4J decides to start up the default data source
defined in the server's application.xml jdbc/OracleDS. So I decide to
define my own orion-application.xml and tell it to use my own
data-source.

It looked like this:
<orion-application
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-application-10_0.xsd";
 deployment-version="10.1.3.1.0" default-data-source="jdbc/myDS"
component-classification="external" schema-major-version="10"
schema-minor-version="0" >
   <imported-shared-libraries>
       <remove-inherited name="oracle.toplink"/>
       <remove-inherited name="oracle.persistence"/>
   </imported-shared-libraries>
</orion-application>

I now reference the datasource in my persistence.xml like:

<jta-data-source>jdbc/myDS</jta-data-source>

I then get an error like:

Exception creating EntityManagerFactory
using PersistenceProvider class
oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider for
persistence unit

So, I add
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
to my persistence.xml, now I get further, but now I get weird naming
errors, and class loader issues. I look into this and it appears
that's because of the way the shared libraries are loaded, and the
wiki says I need to modify a bunch of system.xml files and define a
shared library, bla, bla, bla. I can smell the headaches when I need
to explain this to the production server admins.

So, I end up removing the jta-data-source and provider entries from my
persistence.xml and change my orion-application.xml to look like:
<orion-application
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/orion-application-10_0.xsd";
 deployment-version="10.1.3.1.0" default-data-source="jdbc/myDS"
component-classification="external" schema-major-version="10"
schema-minor-version="0" >

</orion-application>


I also need to define the datasource on the server even though I don't
use it, otherwise OC4J will force me to use the default data source
which is not defined on the server.

Looking at the logs my app works now, and data source defined in
spring is being used.

What are the ramifications of bypassing OC4J's transaction
handling/persitance voodoo? I'm still using the OC4J load time weaver
for spring, but as far as I can tell Spring is managing the connection
and transactions so I won't get the fancy transaction failover OC4J
JTA offers.

I'd really like to not have to define a datasource to make OC4J go
through with the deploy, but it's the only way I can find to deploy an
eclipselink app to OC4J without the need for server xml hacking,
perhaps in future versions it will be easier to use OC4J with
Eclipselink since they're part of the same tech stack.

./tch
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users




------------------------------

Message: 2
Date: Tue, 01 Dec 2009 15:32:10 -0400
From: Gordon Yorke <gordon.yorke@xxxxxxxxxx>
Subject: Re: [eclipselink-users] multible fetch joins
To: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Message-ID: <4B156F3A.2020606@xxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-15"

Is there an eager relationship to the "localized_article" that is not joined in the relationship? Also unless you actually need multiple levels of fetching (which you are not using in your example) you could simply write the query as:
"SELECT a FROM Article a JOIN FETCH a.locals"
--Gordon

Michael Simons wrote:
Hi Tom,

so now I'm using hints on queries like
query.setHint("eclipselink.join-fetch", "e.address");

Unfortunately this doesn't work like expected, at least not always.

(Model: Article(1:N)LocalizedArticle

The following code
		query = em.createQuery ("SELECT a from Article a");
		query.setHint ("eclipselink.left-join-fetch", "a.locals");
		query.getResultList ();

leads to the following SQL:

[EL Fine]: 2009-12-01
18:42:20.748--ServerSession(8279577)--Connection(7438069)--Thread(Thread[main,5,main])--SELECT
t1.article_id, t1.needs_addtank, t1.ext_id, t1.jdo_version, t1.alt_ex_id, t1.product_id,
t1.caution_id, t0.localized_article_id, t0.nme, t0.jdo_version, t0.article_id, t0.lnguage_id
FROM article t1 LEFT OUTER JOIN localized_article t0 ON (t0.article_id = t1.article_id)

[EL Fine]: 2009-12-01
18:42:20.763--ServerSession(8279577)--Connection(7438069)--Thread(Thread[main,5,main])--SELECT
localized_article_id, nme, jdo_version, article_id, lnguage_id FROM localized_article WHERE
(article_id = ?)

The second statement is repeated for each Article.

I don't understand why the second statement is generated at all. All columns are already part of
the first statement.

Might this be a bug? I guess it might because this happens not always.
I assured that the association is FetchType=LAZY in both directions.
Any help would be appreciated.

-Michael


Tom Ware schrieb:
Hi Michael,

  The limitation on JPQL fetch joins comes from the JPA specification.

  Have a look at the following link to see how you can get multiple
fetch joins in all versions of EclipseLink.

http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#Join_Fetch


  We are currently considering what the feature set will be for
EclipseLink 2.1 and the following enhancement request covers expanding
EclipseLink's JPQL capabilities beyond the JPA spec.  Please feel free
to vote for it and add any comments you have.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814

-Tom



Michael Simons wrote:
Hello [EclipseLink 1.2.0, database=MySQL 5],

I'm trying to port a client/server application first to JPA to enable
the 3-tier migration.
At the moment I try to use EclipseLink as JPA implementation.

EclipseLink 1.2.0 does not support multible fetch joins like
select a from A a fetch join A.b b ...
because the alias 'b' is already denied.

Will this be supported in the 2.x of EclipseLink?

Kind Regards,
Michael

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://dev.eclipse.org/mailman/private/eclipselink-users/attachments/20091201/4cc0c935/attachment.html

------------------------------

Message: 3
Date: Tue, 01 Dec 2009 14:51:46 -0500
From: Tom Ware <tom.ware@xxxxxxxxxx>
Subject: Re: [eclipselink-users] multible fetch joins
Cc: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Message-ID: <4B1573D2.2090300@xxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-15; format=flowed

'looks like I missed the doc for this hint. Your hint should be fine. Have a look at the follow-up post from Gordon Yorke.

Tom Ware wrote:
Hi Michael,

  The code you list has the incorrect hint in it.

query.setHint ("eclipselink.left-join-fetch", "a.locals");

should be:

query.setHint ("eclipselink.join-fetch", "a.locals");

or better:

query.setHint (QueryHints.FETCH, "a.locals");

-Tom


Michael Simons wrote:
Hi Tom,

so now I'm using hints on queries like
query.setHint("eclipselink.join-fetch", "e.address");

Unfortunately this doesn't work like expected, at least not always.

(Model: Article(1:N)LocalizedArticle

The following code
        query = em.createQuery ("SELECT a from Article a");
        query.setHint ("eclipselink.left-join-fetch", "a.locals");
        query.getResultList ();

leads to the following SQL:

[EL Fine]: 2009-12-01
18:42:20.748--ServerSession(8279577)--Connection(7438069)--Thread(Thread[main,5,main])--SELECT t1.article_id, t1.needs_addtank, t1.ext_id, t1.jdo_version, t1.alt_ex_id, t1.product_id, t1.caution_id, t0.localized_article_id, t0.nme, t0.jdo_version, t0.article_id, t0.lnguage_id FROM article t1 LEFT OUTER JOIN localized_article t0 ON (t0.article_id = t1.article_id)

[EL Fine]: 2009-12-01
18:42:20.763--ServerSession(8279577)--Connection(7438069)--Thread(Thread[main,5,main])--SELECT localized_article_id, nme, jdo_version, article_id, lnguage_id FROM localized_article WHERE
(article_id = ?)

The second statement is repeated for each Article.

I don't understand why the second statement is generated at all. All columns are already part of
the first statement.

Might this be a bug? I guess it might because this happens not always.
I assured that the association is FetchType=LAZY in both directions.
Any help would be appreciated.

-Michael


Tom Ware schrieb:
Hi Michael,

  The limitation on JPQL fetch joins comes from the JPA specification.

  Have a look at the following link to see how you can get multiple
fetch joins in all versions of EclipseLink.

http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#Join_Fetch


  We are currently considering what the feature set will be for
EclipseLink 2.1 and the following enhancement request covers expanding
EclipseLink's JPQL capabilities beyond the JPA spec.  Please feel free
to vote for it and add any comments you have.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=219814

-Tom



Michael Simons wrote:
Hello [EclipseLink 1.2.0, database=MySQL 5],

I'm trying to port a client/server application first to JPA to enable
the 3-tier migration.
At the moment I try to use EclipseLink as JPA implementation.

EclipseLink 1.2.0 does not support multible fetch joins like
select a from A a fetch join A.b b ...
because the alias 'b' is already denied.

Will this be supported in the 2.x of EclipseLink?

Kind Regards,
Michael

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


------------------------------

Message: 4
Date: Tue, 01 Dec 2009 15:37:11 -0800
From: Mark Robinson <mark.robinson@xxxxxxxxx>
Subject: [eclipselink-users] Cannot set Factory Instantiation policy
	with	Weaving Enabled
To: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Message-ID: <4B15A8A7.2070308@xxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

So,

I've got a session customizer which sets an instantiation policy for my beans. Specifically, I pass an object and a method name to build the correct object for my entities. But here's the problem, I can't use EclipseLink weaving with it enabled. When weaving is enabled, EclipseLink will refuse to invoke the method, falling back the default construction methods. Without weaving, I can set the policy but I use weaving to lazy load some large and seldom accessed columns.

I'm using EclipseLink 1.2, which ships the JDeveloper 11.1.1.2.0.

It worked in the previous version of EclipseLink but not anymore. Does anyone have any insight into this?

Mark


--
Oracle <http://www.oracle.com>
Reinhard Girstenbrei | Senior Principal Technical Support Engineer
Phone: +498914302318 | Mobile: +491775941318
Oracle Oracle Customer Service

ORACLE Deutschland GmbH | Riesstr. 25 | 80992 München

ORACLE Deutschland GmbH, Hauptverwaltung: Riesstraße 25, D-80992 München
Geschäftsführer: Jürgen Kunz, Registergericht: Amtsgericht München, HRB 82775 Green Oracle <http://www.oracle.com/commitment> Oracle is committed to developing practices and products that help protect the environment



Back to the top