openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "C N Davies" <...@cndavies.com>
Subject RE: Dynamic entity definition creation - is it possible?
Date Fri, 24 Jul 2009 04:09:20 GMT
What I'd love to have is something like I have used in a commercial ORMS
based product for many years that allows definition of classes in XML and
the XML is loaded dynamically at runtime. I guess a little like JSP where I
can modify the pages at runtime and the classes get regenerated. What I
often do using the commercial product is read the incoming data, generate
some xml that represents the shape of the data, dump the xml into a specific
directory which the server monitors. When the server sees the new XML it
parses it and does a reshape/create of any required tables instantiate an
instance of the modified/new class, I can wait for this to complete and then
call the generated class and access it's methods.

There are a lot of issues here of course, including obvious the risk of
modifying your DB at runtime on a production system. The other main issue is
that on large DBs the reshape can take considerable time and put significant
load on he server.  All that aside, it does allow a very dynamic application
that can bend and stretch to the data requirements. Using statically defined
entities strikes me as very much like hard coding things.

-----Original Message-----
From: Pinaki Poddar [mailto:ppoddar@apache.org] 
Sent: Friday, 24 July 2009 12:35 PM
To: users@openjpa.apache.org
Subject: RE: Dynamic entity definition creation - is it possible?


Hi,
  Interesting discussion.
  Time and again this discussion comes up with persistence of semi-strictly
typed (or relaxed-type, in my preferred nomenclature) data. Some prefer XML,
some a Java Map, while I have seen the adventurous venture into dynamic
bytecode generation as well. 
   My view is that the representational choice somewhat depends on what kind
of query support one needs on the data that comes from a relaxed-type
environment. If the application needs full query support on the properties
of the datum (quite expected -- otherwise why it needs to store it in a
database anyway?), some mechanics must convert the relaxed-type data to
strict-typed POJO -- rest can then be taken care of by a JPA provider. 

   A powerful bytecode generation library works within OpenJPA  to make
dynamic class generation a feasible approach. For XML data, a plug-in called
Fluid is available which has been reportedly used for production systems. 

  Daryl described a mapping based solution in this post --  which sounded
interesting. Will like to know more details if that is sharable/public. If
you find the Map-based approach addresses your need -- it will be good for
the community if you share that design.   

    
    

crispyoz wrote:
> 
> Hi Daryl,
> 
>  
> 
> I just took out my pencil and paper ad drew out the process based on your
> recommendation and Lairds. A map makes a whole load of sense because it
> means I can add anything I want at run time without getting involved in
> dynamic class generation and runtime enhancement etc etc .etc ...
> 
>  
> 
> For report generation I can normalise the data in my SQL that feeds the
> report module. Easy !
> 
>  
> 
> Thanks so much for advice!  I was right in one respect  "I might be
> thinking
> in the wrong direction .."
> 
>  
> 
> Chris
> 
>  
> 
> From: Daryl Stultz [mailto:daryl@6degrees.com] 
> Sent: Friday, 24 July 2009 3:01 AM
> To: users@openjpa.apache.org; cnd@cndavies.com
> Subject: Re: Dynamic entity definition creation - is it possible?
> 
>  
> 
> On Thu, Jul 23, 2009 at 12:55 PM, C N Davies <cnd@cndavies.com> wrote:
> 
> Hi Laird,
> 
> You may well be right
> 
>  
> 
> WHOA! Laird gets credit? I suggested that in my second post. (Actually my
> first post describes a Map but I didn't spell it out.)
> 
>  
> 
> I'm just kidding, everyone.
> 
> 
> -- 
> Daryl Stultz
> _____________________________________
> 6 Degrees Software and Consulting, Inc.
> http://www.6degrees.com
> mailto:daryl@6degrees.com
> 
> 
> 


-----
Pinaki 
-- 
View this message in context:
http://n2.nabble.com/Dynamic-entity-definition-creation---is-it-possible--tp
3310100p3313464.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Mime
View raw message