Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Unexpected Queries

Hi Michael,

If Geronimo is actually JEE 5 compliant, weaving should happen automatically. To be honest, I've never tried EclipseLink on Geronimo, but a quick search of the wiki site yields a pointer to how to developer JPA applications in Geronimo. I think there is a pretty good chance it will work automatically.

If it does not work automatically, whether the agent will work depends on how Geronimo does class loading. The agent is used to take an advanced look at the entities in your persistence unit (before they are loaded by the classloader). For most application servers, JEE applications are loaded in their own classloader space, and that precludes the agent from working since the entities are not even available to the classloader that loads the application server itself. In that case, static weaving is the way to go.

-Tom

Michael Simons wrote:
Thanks Tom,

we are porting a 2tier application to 3tier in multible steps. Therefore parts are already
running on Geronimo (JEE complinat) while other parts are still Java SE.

Do I guess right when assuming the weaving with a java agent also works for Geronimo?
Should I post this question on the Geronimo users mailing list?

Kind Regards, Michael

Tom Ware schrieb:
Hi Michael,

  Are you running in an application server, or in Java SE?

  In EclipseLink LAZY xToOne mappings are implementated using weaving,
so depending on your deployment strategy, you may have to do some
configuration.

- In you are in a Java EE compliant application server, everything
should work automatically
- If you are in Java SE, you should run with a java agent
- If you are in a non Java EE compliant server, you should use static
weaving

  Here are some docs about weaving:

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


-Tom

Michael Simons wrote:
Hello,

Assume the following part of our model
Scenario (N:1) LoginUser (N:1) Language
No attribute is marked "FetchType.EAGER" but all are "LAZY".

My test program does the following JPQ:
  Query q = em.createQuery ("select s from Scenario s where s.id = 1");
  Scenario scenario = (Scenario)q.getSingleResult ();

But EL generates the following queries:
  SELECT scenario_id, creation_date, vrsion, nme, ext_id, alt_ex_id,
jdo_version, login_user_id
  FROM scenario WHERE (scenario_id = 1);

  SELECT login_user_id, passwd, mail, phone, alias, nme, login,
lnguage_id, sales_office_id
  FROM login_user WHERE (login_user_id = 1);

  SELECT lnguage_id, nme, abbreviation FROM lnguage WHERE (lnguage_id
= 1);

So for a reason I don't know of, EL descides to load the "owner"
(login_user) of the scenario as
well as the "language" (lnguage_id) of that user.

EL behaves the same on other JPQL-Queries, that leads to a problem,
because every line is
selected in a single statement. So this leads to a mass of SQL
statements.

My persistence.xml:
  <persistence-unit name="otee" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
<class>net.uniopt.domain.config.Scenario</class>
        <class>net.uniopt.domain.sys.Language</class>
        <class>net.uniopt.domain.usrmngmt.LoginUser</class>

    <properties>
      <property name="javax.persistence.jdbc.driver"
value="com.mysql.jdbc.Driver"/>
      <property name="javax.persistence.jdbc.url"
value="jdbc:mysql://smithers:3306/ot_diermeier_324"/>
      <property name="javax.persistence.jdbc.user" value="otcs"/>
      <property name="javax.persistence.jdbc.password" value="otcs"/>
      <property name="eclipselink.persistence-context.flush-mode"
value="Commit" />
      <!-- To print SQL statements  -->
      <property name="eclipselink.logging.level" value="FINE" />
    </properties>

  </persistence-unit>


Any hint is appreciated.

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


Back to the top