Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 41029 invoked from network); 9 Jul 2007 14:10:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Jul 2007 14:10:26 -0000 Received: (qmail 95058 invoked by uid 500); 9 Jul 2007 14:10:28 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 95030 invoked by uid 500); 9 Jul 2007 14:10:28 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 95021 invoked by uid 99); 9 Jul 2007 14:10:28 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jul 2007 07:10:28 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jul 2007 07:10:24 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 7935E71403F for ; Mon, 9 Jul 2007 07:10:04 -0700 (PDT) Message-ID: <10940191.1183990204476.JavaMail.jira@brutus> Date: Mon, 9 Jul 2007 07:10:04 -0700 (PDT) From: "Kevin Sutter (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Created: (OPENJPA-281) EAGER not the default fetch type without the @Basic annotation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org EAGER not the default fetch type without the @Basic annotation -------------------------------------------------------------- Key: OPENJPA-281 URL: https://issues.apache.org/jira/browse/OPENJPA-281 Project: OpenJPA Issue Type: Bug Components: jpa Affects Versions: 0.9.7 Reporter: Kevin Sutter Assignee: Kevin Sutter Fix For: 1.0.0 There's an on-going discussion on the dev mailing list concerning this problem (http://www.nabble.com/Eager-fetching-not-working-with-enums-and-lobs-tf4037105.html). Since I've gotten agreement on at least one aspect of the problem, I decided to open this JIRA Issue to document the problem. Here's a summary of the problem: I am finding that the supposed default action of Eager fetching is not happening with @Enumerated and @Lob fields. If I explicitly specify the @Basic annotation, then the fields are eagerly fetched. But, without this extraneous @Basic, these fields are lazily loaded. This action does not seem to be consistent with the spec. Nor, can I find any mention of this alternate behavior in our OpenJPA manual. Sounds like a bug to me. Any other insights? This works (eager loading kicks in): @Basic @Enumerated(EnumType.STRING) private Gender gender; This does not work (lazy loading kicks in): @Enumerated(EnumType.STRING) private Gender gender; I have also tried to use defaults (without any annotations), and lazy loading still kicks in: private Gender gender; The JPA spec attempts to address this situation in section 9.1.18... Section 9.1.8 of the JPA spec indicates that @Basic is optional and applies to the following types: "..Java primitive types, wrappers of the primitive types, java.lang.String, java.math.BigInteger, java.math.BigDecimal, java.util.Date, java.util.Calendar, java.sql.Date, java.sql.Time, java.sql.Timestamp, byte[], Byte[], char[], Character[], enums, and any other type that implements Serializable." And, since the default fetch type for @Basic is EAGER, it looks like we need to do eager fetching for both @Enumerated and @Lob fields unless otherwise overridden by a LAZY fetch type (ie. @Basic(fetch=LAZY)). Agree? We're still working on the agreement... :-) Thanks, Kevin -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.