[ 
https://issues.apache.org/jira/browse/ARIES-1247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14163308#comment-14163308
 ] 

Charlie Mordant edited comment on ARIES-1247 at 10/8/14 11:48 AM:
------------------------------------------------------------------

Let's have a bundle with as content:
* An Hello entity
* A persistence.xml (referencing this HelloEntity)
* An HelloDao:
@OsgiService
public class HelloDao {
@Inject//or <bean class="..">
@OsgiServiceReference
private EntityManagerFactory emf;//or <jpa:unit/>
public void save (Hello hello) {
emf.createEntityManager().save(hello);//to sum up
}
}

Will this bundle could be in active state if the emf will be created once in 
active state?
The dao EMF OSGI service reference will not be resolved so I think it won't 
start...


Regards,
Charlie


was (Author: tcharl):
Let's have a bundle with as content:
* An Hello entity
* A persistence.xml (referencing this HelloEntity)
* An HelloDao:
@OsgiService
public class HelloDao {
@Inject
@OsgiServiceReference
private EntityManagerFactory emf;
public void save (Hello hello) {
emf.createEntityManager().save(hello);//to sum up
}
}

Will this bundle could be in active state if the emf will be created once in 
active state?
The dao EMF OSGI service reference will not be resolved so I think it won't 
start...


Regards,
Charlie

> EntityManagerFactoryManager: remove the try of creation of 
> EntityManagerFactories from Bundle.RESOLVED event
> ------------------------------------------------------------------------------------------------------------
>
>                 Key: ARIES-1247
>                 URL: https://issues.apache.org/jira/browse/ARIES-1247
>             Project: Aries
>          Issue Type: Improvement
>          Components: JPA
>    Affects Versions: jpa-container-context-1.0.3
>            Reporter: Andrei Shakirin
>            Assignee: Christian Schneider
>         Attachments: ARIES-jpa-EntityManagerFactoryManager.patch
>
>
> EntityManagerFactoryManager:
> As it was already mentioned in ARIES-1160, I do not see any benefit for 
> trying to create EntityManagerFactories on Bundle.RESOLVED event.
> On time of Bundle.RESOLVED the bundle context is still not initialized and 
> trying of creation EntityManagerFactory will likely failed (Hibernate and 
> EclipseLink implementations are failed by lookup of DataSource service).
> It only confuses user with a stack trace.
> The EntityManagerFactories will be created a tick later on Bundle.ACTIVE 
> event by calling registerEntityManagerFactories() method.
> Patch is attached.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to