ejb-3.0

How can I override an EJB 3 session bean method with a generic argument - if possible at all?

Suppose you have the following EJB 3 interfaces/classes: public interface Repository<E> { public void delete(E entity); } public abstract class AbstractRepository<E> implements Repository<E> { public void delete(E entity){ //... } } public interface FooRepository<Foo> { //other methods } @Local(FooRepository....

Should I use EJB3 or Spring for my business layer?

My team is developing a new service oriented product with a web front-end. In discussions about what technologies we will use we have settled on running a JBoss application server, and Flex frontend (with possible desktop deployment using Adobe AIR), and web services to interface the client and server. We've reached an impasse when it ...

Is there a Problem with JPA Entities, Oracle 10g and Calendar Type properties?

Hello, I'm experiencing the following very annoying behaviour when using JPA entitys in conjunction with Oracle 10g. Suppose you have the following entity. @Entity @Table(name = "T_Order") public class TOrder implements Serializable { private static final long serialVersionUID = 2235742302377173533L; @Id @GeneratedValue(...

Most important problem solved by EJB 3?

The scenario You have developed a webapp using EJBs version 3. The system is deployed, delivered and is used by the customer. If you would have to rewrite the system from scratch, would you use EJBs again? No: Don't answer this question, answer this one instead. Yes: Provide one important, real problem that EJBs solved, based on yo...

EJB3 Transaction Propogation

I have a stateless bean something like: @Stateless public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote { @PersistenceContext(unitName="myPC") private EntityManager mgr; @TransationAttribute(TransactionAttributeType.SUPPORTED) public void processObjects(List<Object> objs) { // this method ...

Top reason not to use EJB 3.0 again?

The scenario You have developed a webapp using EJBs version 3. The system is deployed, delivered and is used by the customer. If you would have to rewrite the system from scratch, would you use EJBs again? Yes: Don't answer this question, answer this one instead. No: Provide the top reason for not using EJBs again, based on your pe...

Why an InitialContext on Remote EJB3 Session Beans

Why do I need to specify various driver info when I call a remote EJB? java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=localhost:1099 Shouldn't we only need to specify the url/port and the EJB container should resolve all that o...

JBoss/EJB vs Symmetric DS

Hi all I'm working on a project which is just about to start, and since I was busy with another one my colleagues went ahead and started working on the specs to the new one. When I came in, they had just chosen to do persistence with plain SQL (promptly accepted my suggestion to add Hibernate, though) but insisted in that data replicati...

EJB3 Business Logic Patterns & Practices

I'm in the process of developing a multi-tiered financial processing application in Java using EJB3 (Hibernate + Glassfish for the app and web services layer, Lift on Glassfish for the web UI) and I'm struggling with the question of where to put my business logic. When this project started, our first notion was to put the bulk of our bu...

How to convert EJB3 annotations to ejb-jar.xml file configuration?

I am looking for a tool which would create ejb-jar.xml configuration file from annotated EJB3 classes. Something like XDoclet, but for annotations, not tags in comments. ...

What's the best way to share business object instances between Java web apps using JBoss and Spring?

We currently have a web application loading a Spring application context which instantiates a stack of business objects, DAO objects and Hibernate. We would like to share this stack with another web application, to avoid having multiple instances of the same objects. We have looked into several approaches; exposing the objects using JMX...

Loading a list on an EJB

I have a remote EJB with a method that validates an object (returning true or false). I want to be able to pass it an ArrayList object and have the EJB load it with the errors encountered during validation, while still receiving true/false as result. How can I do this? So far, I can send it the list, and it's affected on server side, bu...

Configurable values to MDB annotations

I'm trying to use this method for receiving mail in our EJB3 app. In short, that means creating an MDB with the following annotations: @MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "mailServer", propertyValue = "imap.company.com"), @ActivationConfigProperty(propertyName = "mailFolder", propertyValue = ...

How are EJB3 transactions propgated over multiple session beans?

I've read the EJB3 spec and the latest O'Reilly and Manning books and yet I can't see defined anywhere how transactions are propagated over multiple session beans. For example, if I call a method marked as "NEVER" on bean A and bean A calls a method marked as REQUIRESNEW on bean B, what happens? In practice, using JBoss, we've observed...

How to use WS-Security with EJB3 ?

Hi, For one of our projects, I should be able to call a webservice that uses WS-Security, i.e. the SOAP request should be signed with an X.509 certificate. I've been doing some tests to call the webservice through the use of the WebServiceRef annotation and I'm able to call the webservice without WS-Security. So my question is: how can...

Associate arbitrary data with ejb call context

I've got a bunch of stateless ejb 3.0 beans calling each other in chain. Consider, BeanA.do(message) -> BeanB.do() -> BeanC.do() -> BeanD.do(). Now i'd like to access message data from BeanD.do(). Obvious solution is to pass message as a parameter to all that do() calls (actually that's how it works now), but i want some nicer solution...

Are EJB Timers supposed to be persistent/reliable ?

E.g. if I set a timer to expire every day at midnight, what will happen if one "misfire" (does not trigger the callback because the server is down, for instance) ? I can't find that in the documentation. Is there a way to make this timer triggers the callback as soons as the server restart ? PS: I know about Quartz, i'm evaluating EJB ...

Project architecture/organization on Java EE application with EJB 3.0, JPA, Dynamic web projects on JBoss

I have a webapp with different Dynamic Web Projects, each of them generally containing an EJB Project. We want to keep them interacting, as in using beans and classes from each other's EJBs through JNDI, sharing the same database or using their own. But we also want to be able to keep different projects on different servers. What would ...

JBoss: What does the warning EJBTHREE-1246 from the InterceptorRegistry mean?

I am currently developing an EJB 3.0 based application on the JBoss AS 5.0.0.GA and just recently the following warning showed up in the server log: 09:50:19,735 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean container 09:50:19,735 W...

What is the best way to unit test a EJB3 component without having to deploy the component.

I would like to have a JUnit (or other) system where the enterprise beans can be tested in a mock environment so that all resources/beans and so on are injected locally. The enterprise beans should not have to accomplish this. All kinds of injection should be supported. I would like to have a maven plugin for this so that the tests can...