ejb-3.0

EJB3Unit save-function doesn't really save my entity

Hello, I am doing tests on an ejb3-project using ejb3unit session bean test. The following test will fail with the last assertNotSame() check. public void testSave() { Entity myEntity = new Entity(); myEntity.setName("name1"); myEntity = getBeanToTest().save(myEntity); assertNotSame("id should be set", 0l, myEntity.getId());...

Java Persistance Issue

Hi, I am trying to get a simple example up and running using JPA in an EJB through GlassFish. I have the following persistence.xml <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com...

Problem in creating stateless session bean using eclipse

Hi all I am new to EJB and i just started to create helloworld stateless session bean in eclipse. I gave file->new->project then select ejb... But after the project is created when i tried to create session bean by right clicking the project and selecting new->session bean->stateless bean.... Its asking for "enter project name".... ...

Help in EJB Creating Stateless Session Bean

Hi I am beginner to EJB concept. I just read creating stateless session bean !! Here we create 2 interface and a bean. In that Home Interface we use a method create for creating instances. But is that create() method a keyword. It is not showing anything in eclipse. It will good if some can post how to create simple hello world state...

why we use .ejb file

Hi I was asked to read the code of an existing project. There they have implemented stateless session bean with the file extension .ejb. We can have java file which extends sessionbean but wats the use of keeping the file as .ejb ? Anyone can help me out this ? Thanks in Advance. ...

How Can I Query a DB for ResultSet which is not Mapped into an Entity(JPA, JBoss)

I'm running an application in JBoss and Using JPA. For a report I need a group by query which I expect to return a result set with the following structure example: count,idA,idB I did not find a way to implement this in JPA. What are my best options for implementing this considering I'm developing in JBoss 5, EJB3 ...

EJB3Unit testing no-tx-datasource

Hello, I am doing tests on an ejb3-project using ejb3unit http://ejb3unit.sourceforge.net/Session-Bean.html for testing. All my Services long for @PersistenceContext (UnitName=bla). I set up the ejb3unit.properties like this: ejb3unit_jndi.1.isSessionBean=true ejb3unit_jndi.1.jndiName=ejb/MyServiceBean ejb3unit_jndi.1.className=com.comp...

Is tight coupling between the model and the UI avoidable when using RichFaces?

I am using RichFaces with seam and EJB3. Specifically I am using the rich:tree component. The problem I am worried about is the tight coupling between the UI and my EJB3 session bean. In order to make the tree view work, I was forced to include the Richfaces jar files in my EJB3 project. Is this a bad thing? The method below is ca...

Injected EJB sometimes Null

I'm using a stateless EJB via the @EJB annotation... most of the time everything works as it should but it seems that from time to time what is supposed to be injected resolves to a NULL causing a null pointer exception. What could cause this intermittent problem? ...

Making sense of JPA and EJB3 and WebServices

I'm just getting started with JPA, creating stateless session beans from the JPA entities, then accessing the beans through a web service. While I have a lot of experience developing database backed web services "the old way", I have some questions about what's going on behind the scenes with this new "annotation driven approach". What...

Handling connection errors in a MDB

Is it possible to manage connection timeouts or errors in a MessageDrivenBean? You can make the factory to retry connecting a certain number of times but... is it possible to make some actions each time that a reconnection retrial is neccesary? Is it possible to register an ExceptionListener into the MessageDrivenBean's connection someh...

Glassfish limited to two simultaneous threads with JPA/EJB/web service

I'm exposing the following EJB3 stateless session bean through a web service. @Stateless public class UserRoleFacade implements UserRoleFacadeLocal { @PersistenceContext(unitName = "SimpleEA-ejbPU") private EntityManager em; public int count() { System.out.println("thisClass=" + this.getClass().getSimpleName() + "@"...

Occasional weird Glassfish errors, resolved by a restart?

I'm developing a web app using netbeans with GlassFishv3. Every once in a while when I add a new feature in my app, glassfish starts nagging with stupid errors, after a lot of time wasting and panicking, i restart glassfish and run my application again, then suddenly the errors all go away and my site starts acting correctly. (or in cas...

Run EJB3Unit against Oracle Database

I want to run EJB3Unit-Test in my oracle 10g Database. Therefore I use this configuration (ejb3unit.properties). ### The ejb3unit configuration file ### ejb3unit.inMemoryTest=false ejb3unit.connection.url=jdbc:oracle:thin:....:1432:SID ejb3unit.connection.driver_class=oracle.jdbc.OracleDriver ejb3unit.connection.username=user ejb3unit.c...

Enterprise Application

I am thinking about a platform for study application (it is team work). I mean standart JEE 5 (or maybe try raw JEE 6) and Spring. What is your choose? (I don't mean Spring MVC but Spring Beans and EJB3.0) Also i would like to know whar app server you use? (now i use glassfish v2) Thanks, WBR, Den Bardadym. ...

Using Jersey Client inside EJB 3 stateless session bean on Weblogic

Hi, I am using Jersey client inside a EJB 3 stateless session bean. I can deploy the EJB project on Weblogic 11g. But when I try to look up the bean from a JSP, I get the following error javax.ejb.EJBException: EJB Exception: ; nested exception is: java.lang.NoClassDefFoundError: com/sun/jersey/api/client/Client; nested exception is...

Stateless and Stateful Enterprise Java Beans

I am going through the Java EE 6 tutorial and I am trying to understand the difference between stateless and stateful session beans. If stateless session beans do not retain their state in between method calls, why is my program acting the way it is? package mybeans; import javax.ejb.LocalBean; import javax.ejb.Stateless; ...

Injecting EJB 3 session beans into struts 2 action classes

Hi, Is there a way to inject EJB 3 stateless session beans into struts 2 action classes. Please dont suggest a JNDI look up. I want inversion of control. It would be nice if some one gives me links to illustrations. Ofcourse, I will give you a up vote :). ...

How do I call a remote EJB in an EAR from another?

In Weblogic 10.3, how do I inject a remote EJB from one EAR into a Stateless bean of another, both EARs being deployed in the same container? Ideally I'd like to do as much as possible with annotations. So suppose I have the following interface: public interface HelloService { public String hello(); } implemented by the following E...

EJB3 transaction rollback

I'm using CMT in EJB3 state-less session beans. Also I've created my own Exception having the annotation "@ApplicationException (rollback=true)". Do I have to use "context.setRollbackOnly()" when I want to rollback the transaction? Can I just rollback the transaction by throwing an exception inside public method in the bean? If so (the...