ejb-3.0

Why does query caching with Hibernate make the query ten times slower?

I'm currently experimenting with EJB3 as a prestudy for a major project at work. One of the things I'm looking into is query caching. I've made a very simple domain model with JPA annotations, a @Local business interface and a @Stateless implementation in an EJB-JAR, deployed in an EAR together with a very simple webapp to do some basi...

Hibernate in Glassfish - Ejb3Configuration NoClassDefFoundError

I've put the Hibernate libraries in both the Glassfish domain and in the library collection of my project in Netbeans. hibernate-entitymanager.jar contains both HibernatePersistence (the last class in the call stack) and Ejb3Configuration, so I'm rather stumped as to why I get the missing class error for Ejb3Configuration. java.lang.NoC...

Optional injection in EJB3 bean or runtime dependency checks

I want to define injection so that only if the injected interface has EJB it will be injected. This is used as a plug-in to the main EJB. How to do this? Is there some annotation for this? I can use @PostConstruct to manually "inject" the variable. But then I have to handle the dependencies by myself. How can I handle dependencies knowi...

Java or PHP for homegrown CMS?

My boss has an idea for a web app he would like to build. Long story short it will need a lot of CMS features and a lot of social networking features, and some other unique things as well. We looked into just leveraging different CMS platforms like drupal and joomla etc, but they really don't meet our needs. We have decided to build o...

How to persist the same JPA Entity at multiple databases (distributed system)?

(How) is it possible to persist a JPA Entity at the databases of multiple servers without copying everything to DTOs? We have a distributed system. Some applications do have DBs for caching purposes. The JPA Provider throws an Exception in which it complains that it cannot persist a detached object. But I would like to preserve the ID ...

EJB Interceptors in Weblogic

I have an EJB in Weblogic 10.3 that has en EJB interceptor defined for it like such: @Stateless(name="MyEJB") @Interceptors ({AuditInterceptor.class}) public class MyEJBImpl extends BaseEJB implements MyEJB It appears as if the interceptor advice is only being applied to certain methods in the EJB. I am using the @AroundInvoke annota...

How to process data in multiple threads using EJB3?

Sometimes it would be useful to distribute the processing of some data to several threads in an EJB3 session bean. Let's say that a stateless session bean fetches a lot of data from the database, splits it into several partitions and would like to spawn processing of those partitions in their own, parallel threads. What is the best way ...

How do I migrate ejb2 stateless session beans to ejb3 piecemeal?

The EJB3 spec indicates that EJB2 and EJB3 can co-exist in a single application. I wish to migrate my EJB2 stateless session beans to EJB3 stateless session beans. This question does not relate to JPA at all (that is a separate piece of work to be carried out in the future) I'm running on websphere 6.1 with the EJB3 feature pack instal...

Configuring one ear to call remote ejb3 on another ear in JBoss

I am new to EJB3 and am missing something when it comes to accessing a @Remote @Stateless bean deployed as an ejb module inside an ear file. I want to access a remote bean in lima.ear from soup.ear. Here is what I am doing now (somewhat abbreviated): //deployed under lima.ear @Remote @Stateless public interface LimaBean { String s...

Websphere 6.1 ejb3 authenticating user and mapping to role

I'm upgrading an application from an old ejb2 setup to use ejb3's using the ejb3 feature pack on websphere 6.1 I've got a ServletContextListener which does some initialisation when the servlet context starts, part of this initialisation involves calling ejb's. The server is set up to use FileRegistrySample for its custom user registry,...

How to specify a different jndi-name than the default for an EJB in JBoss 4.2.2.GA?

By default it seems the jndi name of a bean is based on the ear in which it is contained. An EJB named MyBean my-app.ear will have the name "my-app/MyBean/local". How can I change that behavior declaratively? I want the jndi name to be "something-else/MyBean/local". It has to be declarative rather than with an annotation b/c I can'...

JNDI Name binding in JBOSS 5.1.0 Beta

Hi, I am following the MasteringEJB4thEdition book, which I downloaded from The Server Site website. There is a simple example of HelloBean, which works perfectly with GlassFish V3 app server. The same example when deployed on JBOSS fails because of JNDI name lookup. Is there any rule how the JNDI lookup names in JBOSS are decided if ...

How is it possible to limit the number of instances of an EJB ?

I wan to check if my stateful bean is passivated/activated and the corresponding callbacks are called properly. For that I want to configure the containers GlassFish and/or JBOSS to limit the number of instances of the bean. Is it possible ? If yes, how ? ...

How do you add a dependency to a JBoss EJB with a generated WebService?

I'm trying to deploy an EJB in JBoss that uses the @WebService annotation. However, the EJB has a dependency on an EJB in another ear. By adding the @Depends annotation, the EJB start is delayed until after the ear is loaded, but it appears the WebService generator is still trying to start up the generated WAR as soon as it sees the anno...

@EJB injection and the Enterprise Naming Context - relation between the two.

The JEE specification states that an EJB injection like this: @EJB MyInterface myBean; will create en entry in the Enterprise Naming Context, viz. java:comp/env/.MyInterface/myBean. It is up to the deployer to bind this context entry to a real value and to inject this value in the myBean field. Now I have the feeling I am missing som...

How do I start with EJB3 and JBoss?

I'd like to get into ejb3 to gain some practice in writing for it. I searched for tutorials and how-to's but could find some scarce unhelpful information. I'm looking for a tutorial or walkthrough that will guide me from the very basics (Which software do I need to install?) to write a "Hello World" for EJB3 with JBoss. In short - Wher...

How to hide RuntimeException details from EJB client ?

I have a JEE5 application that exposes services using (local) session beans. When an internal fault occurs during service execution, a RuntimeException is thrown and encapsulated by JBoss(5.0.1) in a javax.ejb.EJBTransactionRolledbackException. The problem is that client applications receiving this EJBTransactionRolledbackException can...

JBOSS web service client doesn't work ( runtime modeler error: Wrapper class not found )

I have a simple hello-world EJB3 successfully deployed as web service. I can check it with url: http://localhost:8080/jbossws/services Following is the client which works for Glassfish but doesn't work for JBOSS package com.hardik.mejb; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; impor...

Configuring an MDB in JBOSS

How maxMessages property affects the MDB? For example: @ActivationConfigProperty(propertyName = "maxMessages", propertyValue="5"). How would this value affect if maxSessions is 10? ...

How to use non-key composite elements in EJB3?

Using EJB3/JBoss, how can I use a composite element from a table, e.g. @Entity public class X { @Id private int id; private Coordinate coordinate; } where Coordinate is a defined as (setters/getters left out for readability): public class Coordinate { int x; int y; } And everything should be mapped to Table X which...