tag:blogger.com,1999:blog-18772002.post3342168414579421119..comments2023-12-06T19:00:46.094+00:00Comments on OSGi Blog: PersistenceJürgen Alberthttp://www.blogger.com/profile/02725834158183495837noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-18772002.post-59668687619799905402013-07-21T08:03:00.459+00:002013-07-21T08:03:00.459+00:00I don't have any experience with JDO, only wit...I don't have any experience with JDO, only with JPA. Both standards are compromises in a way that they abstract too many things. In my point of view:<br /><br /><strong>JPA only supports RDBMS, but hides SQL</strong><br /><br />You've <a href="http://blog.osgi.org/2013/07/the-trouble-with-objects.html" rel="nofollow">blogged about this yourself</a>. JPA creates an impedance mismatch Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-18772002.post-66548436635537423642013-07-11T00:41:09.744+00:002013-07-11T00:41:09.744+00:00Well, mainly because fragments doesn't have it...Well, mainly because fragments doesn't have its own lifecycle, so I don't have module independence.<br />In this case I have to create one PU bundle for the entire system, set it using config admin (that is cool) and put all entities of each business module inside its own fragment. But if I need to do any maintenance in only one module, I have to stop/refresh all others together... Cristiano Gaviãohttps://www.blogger.com/profile/14887987648892135349noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-34737101132094012372013-07-10T13:40:38.423+00:002013-07-10T13:40:38.423+00:00Though the blog post was about JPA versus JDA it s...Though the blog post was about JPA versus JDA it seems people are heaving problems with JPA. I 250% agree with your objections, I am pretty sure you could set the JDBC driver outside persistence XML. I will investigate and write a blog about OSGi an JPA, hoping to show how it can be done well.Peter Krienshttps://www.blogger.com/profile/11373850803487010328noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-46806669114083956442013-07-10T09:09:43.683+00:002013-07-10T09:09:43.683+00:00Hi Peter,
My main issue with OSGi JPA is related ...Hi Peter,<br /><br />My main issue with OSGi JPA is related to database connection configuration. <br />In J2EE you can easily define a JDBC datasource on the server and let your application only know the JNDI name.<br />This of course has the advantage that you can change the database driver, connection parameters, pooling configuration, statement cache etc without having to change your Giammahttps://www.blogger.com/profile/04703973847802955656noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-33941233438431248812013-07-09T07:59:31.091+00:002013-07-09T07:59:31.091+00:00@Peter The solution with fragments would work. But...@Peter The solution with fragments would work. But I'm using my domain objects in different products and each product has its own persistence bundle. I would need fragments for each product :(<br />What I would like to have is:<br />1. Each business module has its bundle containing the entities. No dependency to any persistence bundle.<br />2. There is a product specific persistence bundle Anonymoushttps://www.blogger.com/profile/00447451092891531188noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-70538753156903652352013-07-09T06:44:14.376+00:002013-07-09T06:44:14.376+00:00Not necessarily - the JPA impl may try to discover...Not necessarily - the JPA impl may try to discover entities based on annotation scanning. In this case, there are no classes in the persistence.xml. Iirc this was something I never got working with JPA and OSGI - I always had to put the classes in explicitly. <br /><br />John Hawksleyhttps://www.blogger.com/profile/18426956649028266867noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-67576575642690543832013-07-09T06:31:43.457+00:002013-07-09T06:31:43.457+00:00What is the problem with fragments in Paas?What is the problem with fragments in Paas?Peter Krienshttps://www.blogger.com/profile/11373850803487010328noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-31410133926502921572013-07-09T06:31:16.986+00:002013-07-09T06:31:16.986+00:00It sounds like very bad practice since you now hav...It sounds like very bad practice since you now have 'hidden' dependencies; the persistence.xml now contains class names that are not present. <br /><br />Possible solution: Use a bundle for the persistence.xml and then put the domain objects in fragments. <br />Peter Krienshttps://www.blogger.com/profile/11373850803487010328noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-51658908305449096082013-07-08T21:11:06.103+00:002013-07-08T21:11:06.103+00:00You could be right about JDO being undervalued, I&...You could be right about JDO being undervalued, I'm not sure because I didn't use it outside the AppEngine context. <br /><br />In the process of a more streamlined development experience I think the focus should be on technology that most people know about (and that's definitely JPA in this discussion). Moving from JPA to JDO would be a show stopper for a lot of people (event if JDO Anonymoushttps://www.blogger.com/profile/02302162576058939890noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-3315252138620061262013-07-08T13:36:21.044+00:002013-07-08T13:36:21.044+00:00A persistence bundle for OSGi is container indepen...A persistence bundle for OSGi is container independent, of course. Maybe container independence is the wrong word here. My problem is as follows: We have an application that contains several business modules. Each module has its own jar containing the entities. The product delivered to the customer contains all the modules for that customer and a persistence.xml. All entities from the different Anonymoushttps://www.blogger.com/profile/00447451092891531188noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-13665509750915769962013-07-08T11:56:02.581+00:002013-07-08T11:56:02.581+00:00I have been using Gemini JPA + EclipseLink for a w...I have been using Gemini JPA + EclipseLink for a while. I like the way that EMF/EMFB services are generated in the name of the PU bundle using extender pattern. <br />But the problem I see in the current JPA spec is that entities must come from one unique Bundle. We could use fragments to extend an existent PU but fragments is not good to PaaS. <br />In our case, customer could choose which Cristiano Gaviãohttps://www.blogger.com/profile/14887987648892135349noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-71333209956773582392013-07-08T11:34:25.499+00:002013-07-08T11:34:25.499+00:00a) It seems good practice anyway to keep your doma...a) It seems good practice anyway to keep your domain objects close to your persistence XML since they are highly coupled? <br />b) I fail to see why you would not have container independence? Can you elaborate?Peter Krienshttps://www.blogger.com/profile/11373850803487010328noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-63340745441514996402013-07-08T11:17:19.771+00:002013-07-08T11:17:19.771+00:00According to the OSGI Enterprise spec a persistenc...According to the OSGI Enterprise spec a persistence bundle is required to contain all the entities that the persistence unit it defines refers to.<br />This is a drawback in OSGI + JPA since it prevents independent deployment and container independence.Anonymoushttps://www.blogger.com/profile/00447451092891531188noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-2094826182138305252013-07-08T09:55:10.776+00:002013-07-08T09:55:10.776+00:00@Paul: I think I listed your arguments but reading...@Paul: I think I listed your arguments but reading up on it I can't escape the feeling that JDO is undervalued ... especially now with NoSQL becoming more popular. It is kind of scary that JDO seems to be a superset of JPA, even for relational.<br />Peter Krienshttps://www.blogger.com/profile/11373850803487010328noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-49761596286652906862013-07-08T08:55:14.680+00:002013-07-08T08:55:14.680+00:00Hi Peter,
OSGi + JPA work fine together in projec...Hi Peter,<br /><br />OSGi + JPA work fine together in projects I'm participating. EclipseLink was chosen as JPA implementation (JPA RI, JPA 2.1 API). The projects do not use any OSGi Enterprise API Implementations (like Apache Aries or Eclipse Gemini) and integrate with JPA API on lower level (we have more control and flexibility to manage EntityManagers). <br /><br />Best regards,<br />Anonymoushttps://www.blogger.com/profile/15456622107452083522noreply@blogger.comtag:blogger.com,1999:blog-18772002.post-51656939544303182512013-07-08T08:46:39.315+00:002013-07-08T08:46:39.315+00:00For MongoDB in OSGi, take a look at the MongoDB co...For MongoDB in OSGi, take a look at the MongoDB component in Amdatu: http://amdatu.org/components/mongodb.html. We use this in production combined with an Object Mapper (Jackson based in our case, but it works with other mappers as well). The component basically configures the standard Java driver using Configuration Admin. <br /><br />JDO vs JPA I would definitely vote for JPA. It always struck Anonymoushttps://www.blogger.com/profile/02302162576058939890noreply@blogger.com