isis-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GESCONSULTOR - Óscar Bou <o....@gesconsultor.com>
Subject Re: Few questions
Date Thu, 12 Dec 2013 23:55:50 GMT
Hi, Satyendra.

We migrated our Domain from JPA to JDO in order to work with Isis. It was really easy and
the advantages to use Isis for implementing the business rules overcomes the invested effort
(less than 2 days) . 

Basically, a find-and-replace work that can nearly be done automatically. 
For each JPA annotation there's an equivalent JDO annotation.

In fact, there are JDO options more flexible than the JPA counterparts (like the possibility
to mix different @Inheritance options on the same class hierarchy [1], comparing with JPA's
@Inheritance annotation [2]).

As you explicitly mentioned it, here are the JDO documentation links to the corresponding
annotations for one-to-one [3], one-to-many [4] and many-to-many [5] relationships between
Domain Entities.

If you want to avoid learning about them, I've just uploaded a new version of the Isis Templates
for Eclipse that contains a set of templates, all them starting with "isjd" (from Is-is JD-O
templates), that allows to automatically add a new one-to-one, one-to-many, or many-to-many
field. Exactly, the following ones are provided:

KEY 		: DESCRIPTION

isjdp			: JDO Property (simple & 1:1 bidir - parent)
isjdp-11p		: JDO Property (1:1 child)

isjdc-1n-b-fk 	: JDO Collection (1:n bidir, foreign key)
isjdc-1n-b-jt 	: JDO Collection (1:n bidir, join table)
isjdc-1n-u-fk	: JDO Collection (1:n unidir, foreign key)
isjdc-1n-u-jt	: JDO Collection (1:n unidir, join table)

isjdc-mn-ub-c	: JDO Collection (m:n bidir - child)
isjdc-mn-ub-p	: JDO Collection (m:n unidir & bidir - parent)


For "simple" properties, we need to explicitly indicate if its nullable.

For bidirectional one-to-one properties, one of them is the parent and the other the child
(the opposite side, referenced through a field on the parent entity - i.e., "mappedBy").

For collections, I've just use Sets (not Lists) as they allow to directly implement "Managed
Relationships" [6] (for just inserting on one side of the collection and automatically update
the other side of the relationships when you execute "getContainer().flush()" ).


For downloading and installing instructions, go to [7]. After that, you can invoke them in
the context of a Java class whille defining the Domain Entity.


Please, if you experiment any problems regarding DataNucleus JDO, don't hesitate to post it
here and it will be solved ASAP.

HTH,

Oscar




[1] http://www.datanucleus.org/products/datanucleus/jdo/orm/inheritance.html
[2] http://stackoverflow.com/questions/10003155/mixing-jpa-inheritance-strategies-inheritancetype-joined-with-inheritancetype

[3] http://www.datanucleus.org/products/datanucleus/jdo/orm/one_to_one.html
[4] http://www.datanucleus.org/products/datanucleus/jdo/orm/one_to_many.html
[5] http://www.datanucleus.org/products/datanucleus/jdo/orm/many_to_many.html

[6] http://www.datanucleus.org/products/datanucleus/jdo/orm/relationships.html
[7] http://isis.apache.org/getting-started/editor-templates.html


El 12/12/2013, a las 20:43, Jeroen van der Wal <jeroen@stromboli.it> escribió:

> Hi Satyendra, welcome to this list.
> 
> I don't totally agree on Dan's answer on your first question, should one
> learn JDO in able to use Isis. Annotating a class with @PersistenceCapable
> and annotation fields of types that are not persisted by default (like
> LocalDate) [1] is enough to get your application running. You need to dive
> into JDO when you want to tap into the power of your database for faster
> repository queries but for prototyping you can easily use Java code to do
> the work. It is at least the way I gradually moved into JDO.
> 
> Datanucleus, the objectstore the we (and Google App Engine) use has an
> interesting JDO vs JPA faq [2], JDO itself goes even a step further by
> stating that "JPA is subset of JDO" [3][4] so moving to JPA would IMHO only
> limit Isis's capabilities.
> 
> But instead of focusing on the differences between the two I should point
> out that the API is quite similar and a programmer with JPA skills should
> have no difficulty with JDO.
> 
> Cheers,
> 
> Jeroen
> 
> [1] http://www.datanucleus.org/products/datanucleus/jdo/types.html
> [2] http://www.datanucleus.org/products/accessplatform_2_1/jdo_jpa_faq.html
> [3] http://db.apache.org/jdo/jdo_v_jpa.html
> [4] http://db.apache.org/jdo/jdo_v_jpa_orm.html
> 
> 
> On Thu, Dec 12, 2013 at 7:58 PM, Dan Haywood
> <dan@haywood-associates.co.uk>wrote:
> 
>> On 12 December 2013 18:34, Satyendra Singh <ssingh@apollo-advisors.com
>>> wrote:
>> 
>>> I have few questions on ISIS usage.
>>> 
>>> 
>>> 1)      I am assuming one has to learn JDO and its DataNucleus
>>> implementation to be able to use it, right?
>>> 
>> 
>> Practically speaking, yes.
>> 
>> In theory, Isis does support multiple object store implementations.  To
>> date, the only ones released as the JDO/DataNucleus objectstore and - for
>> prototyping onlt - the in-memory objectstore.
>> 
>> I would recommend using JDO OS throughout, even for prototyping, though.
>> There are subtle differences between the implementations, for example the
>> way in which bidirectional relationships are (with the appropriate JDO
>> annotations) automatically managed by the JDO OS.
>> 
>> 
>> 
>> 
>>> 
>>> 2)      I am looking for a plain set of instructions, 'step by step' kind
>>> of, to be able to build a simple application myself, but so far I have
>> not
>>> found any. There is a lot of information out there on various concepts
>> but
>>> they don't give you a simplified picture on 'n' things you need to do to
>> be
>>> able to bring up a domain object to screen using ISIS and than I could go
>>> learning each step in detail, if required.
>>> 
>>> 
>> One resource I can point you to is a github repo [1] I put together for a
>> conference talk [2].  I don't know how good the talk was, but the tags in
>> that repo (22 of em) should give you a good idea of how an Isis app can be
>> built up.
>> 
>> 
>> 
>>> 3)      For a real word application, I need to be able to implement using
>>> a domain object that has one-to-one, one-to-many, many-to-one
>> relationship
>>> with other domain object(s), is there any sample application that I can
>> use
>>> as starting point for this.
>>> 
>>> 
>> Yes, there's [1] as mentioned, you can also take a look at Estatio [3],
>> which is the app that Jeroen (one of the other Isis committers) and I have
>> been working on.
>> 
>> 
>> 
>>> 4)      Is  it possible to replace JDO with JPA as JPA skill is more
>>> easily available that JDO ?
>>> 
>> 
>> Not currently.  DataNucleus does support the JPA API, so this is certainly
>> do-able; but it's not a priority at the moment.
>> 
>> Oscar - one of our other committers - might also want to say something; he
>> came to Isis from a JPA standpoint also.
>> 
>> 
>> 
>> 
>> 
>>> Thank you very much
>>> 
>>> Satyendra
>>> 
>>> 
>>> 
>> You're welcome - any more questions, just ask.
>> 
>> Cheers
>> Dan
>> 
>> 
>> 
>> [1] https://github.com/danhaywood/rrraddd-isis-131
>> [2]
>> 
>> http://oredev.org/2013/wed-fri-conference/rrraddd-ridiculously-rapid-domain-driven-and-restful-apps-with-apache-isis
>> [3] https://github.com/estatio/estatio
>> 
>> 
>>> 
>>> This email and any files transmitted with it are confidential
>>> and intended solely for the person or entity to whom they are
>>> addressed and may contain confidential and/or privileged
>>> material.  Any review, retransmission, dissemination or
>>> other use of, or taking of any action in reliance upon this
>>> information by persons or entities other than the intended
>>> recipient is prohibited.  If you have received this email in
>>> error please contact the sender and delete the material from
>>> any computer.
>>> 
>>> Apollo Global Management, LLC
>>> 
>>> 
>>> 
>>> 
>> 


Mime
View raw message