Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 97311 invoked from network); 23 Jul 2009 15:59:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jul 2009 15:59:32 -0000 Received: (qmail 589 invoked by uid 500); 23 Jul 2009 16:00:37 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 511 invoked by uid 500); 23 Jul 2009 16:00:37 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 501 invoked by uid 99); 23 Jul 2009 16:00:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 16:00:37 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [209.85.216.180] (HELO mail-px0-f180.google.com) (209.85.216.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 16:00:26 +0000 Received: by pxi10 with SMTP id 10so687276pxi.25 for ; Thu, 23 Jul 2009 09:00:05 -0700 (PDT) Received: by 10.115.33.10 with SMTP id l10mr2660349waj.103.1248364805857; Thu, 23 Jul 2009 09:00:05 -0700 (PDT) Received: from brevsnb004 ([124.187.142.173]) by mx.google.com with ESMTPS id n33sm4107046wag.56.2009.07.23.09.00.01 (version=SSLv3 cipher=RC4-MD5); Thu, 23 Jul 2009 09:00:04 -0700 (PDT) Reply-To: From: "C N Davies" To: "'Daryl Stultz'" , References: <00b401ca0ba6$8e3a9100$aaafb300$@com> In-Reply-To: Subject: RE: Dynamic entity definition creation - is it possible? Date: Fri, 24 Jul 2009 01:59:57 +1000 Organization: C N Davies Pty Ltd Message-ID: <00bc01ca0bae$a31aad50$e95007f0$@com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_00BD_01CA0C02.74C6BD50" X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcoLqLfTTYlP+Q4CQLqOA0rAY9syGQAA4iPg Content-Language: en-au X-Virus-Checked: Checked by ClamAV on apache.org ------=_NextPart_000_00BD_01CA0C02.74C6BD50 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi Daryl, Thanks for your thoughts, your idea is interesting food for thought indeed. I'm a bit of a puritan when it come to abstractions, and while abstraction is a great thing I must confess to feeling that sometime I take it to the n'th degree and try push it too far. Lately I have been developing my first JPA application and after much research and soul-searching I went with OpenJPA rather than using Hibernate experience (non-JPA version) despite the fact that it's blowing out my timeframes, because I always find Apache software to be innovative and high quality. All of my entities are created (integrated using a fileinputstream of CSV or XLS/XLSX) using a model whereby I read the file headers then search for a setter method that uses "set", then call the setter. My next step is to load data columns that won't have setter methods on the entity class because at build time I may not know the additional custom field names. I guess my challenge is that since I know the entity won't have setters for the new column names in the data set, I want to be able to modify the entity calss at runtime to add the required setter method, then let the enhancer process the newly modified entity definition, then call the new setter method to let OpenJPA handle things as if I had defined these new entity members at design time. I could do this using JPA queries but it seems a little adhoc or impure, so I'm trying to think of a way of doing this without busting my puritanical vision. Chris From: Daryl Stultz [mailto:daryl@6degrees.com] Sent: Friday, 24 July 2009 1:18 AM To: users@openjpa.apache.org; cnd@cndavies.com Subject: Re: Dynamic entity definition creation - is it possible? On Thu, Jul 23, 2009 at 11:02 AM, C N Davies wrote: I might be thinking in the wrong direction so feel free to berate me if I am. I'd like to berate you for building a self-modifying system, but I've done it myself, so I won't. I do have a project (not the self-modifying one) that has a need for adding "custom properties" to an entity. The entity has its core properties in the main table, then a list of custom properties in another table. Custom properties have a "definition" that describes datatype, presentation order and whatnot. In my pre-JPA system, presenting such an entity would involve a "pivot" on the custom properties. This is also required for JPA but you get it for "free" in that the custom property values come into the collection and it's easy enough to work with it in the rendering layer. I'm looking for ways to improve my solution, so don't think I'm proposing it as an alternative to yours. I am interested in how my solution would not work for you. -- Daryl Stultz _____________________________________ 6 Degrees Software and Consulting, Inc. http://www.6degrees.com mailto:daryl@6degrees.com ------=_NextPart_000_00BD_01CA0C02.74C6BD50--