ejb-3.0

Get reference to the EJB3 local business interface inside the JCA adapter

Hi there, I'd like to know whether it is possible to get a reference to the ejb3 local business interfaces inside the jca adapter? Resource adapter and ejb .jar are packed into the same .ear. Application is running under WebSphere AS 6.1 with ejb3 featurepack. I have tried to use ejblocal:<full_class_name_of_local_interface> as JNDI ...

UnmarshalException: Method not found Exception in EJB

Hi all, I have added a method to my stateless sessionBean (getFNEdetails) with one String parameter. But I am getting this error when I try to test in weblogic10 server java.rmi.UnmarshalException: Could not unmarshal method ID; nested exception is: java.rmi.UnmarshalException: Method not found: 'getFNEdetails(ILjava.lang.String;) ...

Turn off Hibernate Logs for certain query

Can you turn off log messages for certain query in Hibernate / EJB 3.0? Is there a way to override the parameter "hibernate.show_sql" for just a single query? ...

EJB containing POJO instance with transaction

I have created POJO facades to be used by Stateless EJBs. These POJO classes contains convenient CRUD methods using Entity beans with transactions. My persistence.xml is defined to use JTA. However my POJO classes is using manual transactions. I think that is the reason why I'm getting this error: "A JTA EntityManager cannot use getTran...

What's the best Communication Pattern for EJB3-based applications?

I'm starting a JEE project that needs to be strongly scalable. So far, the concept was: several Message Driven Beans, responsible for different parts of the architecture each MDB has a Session Bean injected, handling the business logic a couple of Entity Beans, providing access to the persistence layer communication between the differe...

Persistence provider caller does not implement the EJB3 spec

WARN [Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoad er() is null. How do you get rid of the above warning? 0:42:08,032 INFO [PersistenceUnitDeployment] Starting persistence unit pe rsistence.unit:unitName=k12-ear.ear/k12-ejb-1.0.0.jar#k12 10:42:08,3...

Annotations (@EJB, @Resource, ...) within a RESTful Service

Hi! I'm trying to inject a EJB within my RESTful Service (RESTEasy) via Annotations. public class MyServelet implements MyServeletInterface { ... @EJB MyBean mybean; ... } Unfortunately there is no compilation or AS error, the variable "mybean" is just null and I get a NullPointerException when I try to u...

Using injected EntityManager in class hierarchies

The following code works: @Stateless @LocalBean public class MyClass { @PersistenceContext(name = "MyPU") EntityManager em; public void myBusinessMethod(MyEntity e) { em.persist(e); } } But the following hierarchy gives a TransactionRequiredException in Glassfish 3.0 (and standard JPA ...

Best current framework for unit testing EJB3 / JPA

Starting a new project using EJB 3 / JPA, mainly stateless session beans and batch jobs. I've used JUnit in the past on standard Java webapps and it seemed to work pretty well. In EJB2 unit testing was a pain and required a running container such as JBoss to make the calls into. Now that we're going to be working in EJB3 / JPA I'd lik...

How to handle dynamic role or username changes in JSF?

I have a JSF application running on glassfish 2.1 with a EJB 3 backend. For authentication I use a custom realm. The user authenticates using the e-mail-address and password he specified on registration. Everything is working quite well. Now I have two related problems: 1) The user can edit his profile and -- naturally -- he can also c...

OpenEjb DeploymentLoader.getWebDescriptors NullPointerException

I am currently getting the following error when I try to startup an EAR that includes OpenEJB. The error is: java.lang.NullPointerException at org.apache.openejb.config.DeploymentLoader.getWebDescriptors(DeploymentLoader.java:1057) at org.apache.openejb.config.DeploymentLoader.discoverModuleType(DeploymentLoader.java:1162) at or...

Why should i use EJB?

Hello, As we all know that EJB's in 3.1 or 3.0 are simple POJOs. You just need to give annotations here and there and it gets converted to EJB from simple class. So, now my question is why should i use EJBs at all? Can i not do without them? In .Net i created class library and got things done. I never felt the need for anything like EJB....

EJB3 Business Delegates

Is there any reason for making delegate when using EJB3? Because the only real benefit i see from delegate is that it allows to hide lookup and access details of EJB architecture. Well it also provides some decoupling but it's mostly unused, imho. With EJB3 we have injection so now i can just create a variable with @EJB annotation and us...

Elegantly handling constraint violations in EJB/JPA environment?

I'm working with EJB and JPA on a Glassfish v3 app server. I have an Entity class where I'm forcing one of the fields to be unique with a @Column annotation. @Entity public class MyEntity implements Serializable { private String uniqueName; public MyEntity() { } @Column(unique = true, nullable = false) public Str...

Using Session Bean provided data on JSF welcome page

I use JSF managed beans calling EJB methods that are provide data from database. I want to use some data already on the welcome page of the application. What is the best solution for it? EJBs are injected into JSF managed beans and it looks like the injection is done after executing the constructor. So I am not able to call EJB methods ...

Splitting EJBs and interfaces into separate module -- deployment fails

I'm having trouble following this guide to "extract" my interfaces and entities from my EAR to use them from another Web Application: I use NetBeans 6.8 and Glassfish 3.0.1 "Java Class Library" project contains all the entities and interfaces "Java EE Application" project class library added to the project, is packaged into the EAR ...

How to deploy EJB on server?

Hi, I am learning EJB3 from last few days. I have many questions regarding EJB, application servers and deployment of EJB. To start with, I have created one simple helloworld stateless session bean but I don't know how to deploy it on server. It has single bean class, bean interface and one servlet client. I have used eclipse to deve...

Detach an entity from a JPA persistence context (JPA 2.0 / Hibernate / EJB 3 / J2EE 6)

Hi, I wrote a stateless EJB method allowing to get an entity in "read-only" mode. The way to do this is to get the entity with the EntityManager then detach it (using the JPA 2.0 EntityManager). My code is the following: @PersistenceContext private EntityManager entityManager; public T getEntity(int entityId, Class<T> specificClass,...

avaStatic factory pattern with EJB3/JBoss

I'm fairly new to EJBs and full blown application servers like JBoss, having written and worked with special purpose standalone Java applications for most of my career, with limited use of JEE. I'm wondering about the best way to adapt a commonly used design pattern to EJB3 and JBoss: the static factory pattern. In fact this is Item #1 i...

How can I implement a proper counter bean with EJB 3.0?

[EDIT] This question is "how do I do atomic changes to entity beans with EJB 3 and JPA 2.0". Should be simple, right? I tried to fix my code based on the answers I got so far. I'm using JBoss 6.0.0M2 with Hypersonic (just download it and call run.bat). My test case: Create 3 threads and call one of the testCounterMitLock*() 500 times i...