Can you share the stackt trace?
2011/10/12 Norman Klingspor <[email protected]>
> Hi,
>
> I'm trying to integrate an EJB-Project (which is connected to a
> database by hibernate) into my GWT (in more detail move from CDI-Weld
> implementation to GWT).
>
> I created a new ejb-project only containing my entities and their
> clients.
>
> Within my GWT-project I reference to my ejb-project and included the
> compiled class-files into WEB-INF/classes as described everywhere.
>
> From my ServerServiceImpl the entity are reached, my stateless-class
> is called, but the entityManager remains null as I try to reach my
> database.
>
> my code:
>
> ServiceImpl:
>
> private Product product;
>
> @EJB(name = "Product" )
> public void setProduct(Product product)
> {
> this.product = product;
> }
>
> public DatabaseBuilderServiceImpl()
> {
> }
>
> public boolean createDefaultDatabaseEntries()
> {
> boolean returnvalue = false;
>
> returnvalue = product.createTestEntry();
>
> return returnvalue;
>
> my Interface:
> public interface Product
> {
> List<ProductEntity> findAll();
> ProductEntity getProductBy(String productSymbol);
> List<OptionEntity> getOptionsBy(ProductEntity currentProduct);
> List<VariantEntity> getVariantsBy(ProductEntity currentProduct);
> boolean createTestEntry();
> }
>
> my stateless-bean:
> @Stateless(name = "Product")
> @Local(Product.class)
> public class ProductHome extends HomeBase<ProductEntity> implements
> Serializable, Product
> {
> @PersistenceContext(unitName="sung.app.kylintv.ejb")
> protected EntityManager entityManager;
>
> @EJB
> protected Option sessionOption;
>
> /**
> * @return List of available products
> */
> @SuppressWarnings("unchecked")
> @TransactionAttribute(REQUIRED)
> public List<ProductEntity> findAll()
> {
> return entityManager.createQuery("SELECT p FROM ProductEntity
> p ORDER BY p.id").getResultList();
> }
>
> @TransactionAttribute(REQUIRED)
> public ProductEntity getProductBy(String productSymbol)
> {
> return (ProductEntity) entityManager.createQuery("SELECT p FROM
> ProductEntity p WHERE p.name = :productSymbol ORDER BY
> p.id").setParameter("productSymbol", productSymbol).getSingleResult();
> }
>
> @SuppressWarnings("unchecked")
> @TransactionAttribute(REQUIRED)
> public List<OptionEntity> getOptionsBy(ProductEntity
> currentProduct)
> {
> return entityManager.createQuery("SELECT p FROM OptionEntity p
> WHERE p.product = :currentProduct ORDER BY
> p.id").setParameter("currentProduct", currentProduct).getResultList();
> }
> }
>
> the function inside my bean is reached, the entityManager is null.
>
>
> How can I ensure the PersistenceInjection?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.