Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] RCP and Eclipse Link (again)

Hi, I'm the one of the authors of that blog post:

Very simply this means, your entities must be in the same
plugin/bundle as your EntityManager _at this time_. People are working
on ways around this.

When you create an an EntityManagerFactory in eclipselink osgi, you
must pass in the classloader that contains your persistence unit xml
and your entity classes.

Now, that being said, let's say you wanted a security plugin that
contained all your user entities and security logic. You could still
create that plugin, it just would have to have it's own
EntityManagerFactory and entities that were obtained by one
EntityManagerFactory can't be persisted into another.

So we couldn't have our user login (select user using an EM from our
security plugin). Then take that same user and try to merge it into an
EntityManager obtained from our Products plugin. That doesn't mean the
products plugin can't read the User entity, after all it's just a
POJO.

To give you a real life example, we found that things like User
entities are reused through almost every plugin, due to relationships
on business tables via a created by to a user table. Unfortunately we
had to duplicate that same User entity throughout each business area
plugin that was already defined. Now take note of what I said -- we
still have multiple plugins broken up by business area, just each
plugin needs to have natural boundries where it doesn't require entity
sharing -- in our situation bundle=schema. So it wouldn't make sense
to break up your plugins across a schema that is all inter-related on
itself.

Like I say in the article, for me -- it's not really a show stopper at
this point. You still get tons of benefit from EclipseLink, and steps
are being taken by the community to enable true module Entity sharing
across the classloader boundry, so we'll get there eventually.

As for getting started on your own app, I recommend you get the
official Comics example and the one from our blog. (you can use the
same derby DB for both). Build them both, and learn how they work, you
can then adapt the techniques to work for how you like to code.  Also,
don't get caught up in all the weaving black magic, you don't NEED it
to write a great EclipseLink based RCP app, it's neat stuff however,
and something you can add in later once your application is done,
without the need to change any code.

./tch



On Sat, Jan 17, 2009 at 2:57 AM, csergiu77 <csergiu77@xxxxxxxxx> wrote:
>
> I read an very nice article
> :http://www.weheartcode.com/2008/08/27/eclipselink-in-j2se-rcp-applications/
>
> but there is a phrase like :
>
> "Common Gotcha - sharing Entities ..................."
>
> "This isn't as much of a deal breaker as it sounds at first, you just have
> to violate DRY for Entity Classes, which aren't all that interesting in the
> first place. There's nothing stopping you from defining common interfaces or
> Abstract classes that entities from multiple bundles share."
>
> 1 )Can someone explain this in more detail ,maybe just a short example plz ?
>
> I want to build a modular application :
>
> 2)So i have to put all entities in one module ?
>
> 3)Or is possible a configuration like this ? :
>
> base ,security module (user entities)
>
> partner module  depends on base
>
> products module depends on base
>
> invoice module depneds on base,partener,products
>
>  And i saw a gigantic post related to osgi rcp ,hooking ,waving etc......do
> i need to read all those post in order to create a rcp ,eclipselink
> applicaiton ?
>
> There are missing things from that article covered in this older posts ?
>
> THX A LoT
>
> Regards
>
> --
> View this message in context: http://www.nabble.com/RCP-and-Eclipse-Link-%28again%29-tp21513992p21513992.html
> Sent from the EclipseLink - Users mailing list archive at Nabble.com.
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>


Back to the top