|Apache Tuscany > Home > SCA Overview > SCA Java > Java SCA Documentation Menu > SCA Java implementation.jpa||User List | Dev List | Issue Tracker|
The injection of JPA Entity Manager Factory/Entity Manager would allow sharing of EMFs across multiple components, this would be useful in scenarios where you have conversation. In this case, the runtime would be responsible for making sure the EM would be created and closed transparently for the application developer based on the conversation.
In this case, we would be extending the SCA programming model to expose services that interact with a persistent layer in a declarative fashion hiding the implementation details from the service developer.It's all about simplicity, allowing a service to be defined without explicitly coding the persistence layer. This would be a new Tuscany Component Type named Implementaiton.JPA. A developer would provide the business objects that would by JPA to do the OR mapping, and a business interface that would be introspect by Tuscany to properly make the JPA calls to the persistence layer to retrieve the information. Information on how to connect to the data source would be done in the composite, and we could provide some annotations to read
The business object can be defined as per JPA programming model. You can define it as a JPA Entity and make use of JPA annotations, or use the ORM.xml as well.
The Business interface would define the access to the JPA entities, and we would introduce Java Annotations to bind a specific method to a JPA query.
We would use some Convention over Configuration to bind the interfaces methods to proper database activities :
Note that introspection will be required by the runtime to properly identify the operation type being requested. Based on this introspection, the runtime will also be responsible for any necessary conversion to the proper collection being expected as a result.