ejb

JPQL createQuery throws illegalArgumentException

The following simple code throws exception: entityManager.createQuery("SELECT c FROM Customer c"); But if I write entityManager.createNativeQuery("SELECT c.* FROM Customer c", Customer.class) then it works without any error. What might be wrong? I use GlassFish v2.1 with Toplink-essentials. ...

Should MDB call remove() after using stateless session bean?

Our years-old WebLogic J2EE application has a message-driven bean which makes use of a stateless session bean. The MDB onMessage method gets the home interface of the stateless session bean and calls the home interface's create() method to get the actual stateless session bean itself. The code does not attempt to cache the session bean...

Can remote stateless session bean references be cached in EJB3?

I am calling a remote stateless session bean from a J2SE application and would like to cache the reference to the session bean in order to reduce the cost of the lookup. Is this ok? In EJB2 the ServiceLocator pattern was commonly used to cache lookups to remote resources, but EJB3 doesn't have separate EJB Home (which were usually cach...

Issue while getting the Hibernate EntityManagerFactory in Weblogic (EJB3 Application)

I am facing an issue when am getting the EntityManagerFactory from JPA from the following code in weblogic StartUp Class EntityManagerFactory emf = Persistence.createEntityManagerFactory("testEJBPU"); logger.info("Created EntityManagerFactory"); Context ctx = new InitialContext(); ctx.rebind("testEJBPU", emf...

EJB Transaction Type

i have looked for and compreensive article on this and have yet to find one good enough. Can some one explain to me the workings of the transaction types? (Required, RequiresNew, Mandatory, Never...) and mainly how these affect service calls between services with diferent types? ...

How many EJBs is too many?

Hello, I'm currently developing a large piece of software base on JavaEE. We have followed the general guidelines of JavaEE that says that each related set of operations should go into their own EJB. We currently have over 275 different EJB classes (Stateless Session beans). This number is most likely going to grow to at least double th...

EJB Find persisted data in single transaction

Let's say i have two tables in db: Car and Part. Car owns arbitrialy number of parts. Because i use EJB 3.0 i have entity beans for Car and Part and Car entity bean contains list of Part objects. I want to save new Part to db and right after that fetch from db all Cars. I exepect Part i've just added to be amongst parts associated with...

Can't call EJB from FLEX (BlazeDS)

Right now I'm playing with Flex and Java integration and trying to access EJB3 methods by clicking Flex button but it's giving me null pointer error. Here is what I have in my code: [Controller:] public class homePageController { @EJB CategoryFacadeRemote categoryFacade; public String populateDBWithXMLData(){ Ar...

ejb sql [select * from where A & 1]

Hello, i will use a query like this in ejb ql: Select * from whe A&1; But i have the following error: line 1, column 171: unexpected char [&]. How can i use this operator to check the bits in a row? ...

Jboss 5.0 EJB 3.0 Asynchronous Proxy

At http://www.java2s.com/Code/Java/EJB3/EJBtutorialfromJBossAsynchronouscall.htm i've found an example showing how to call ejb methods in asynchronous fashion. Do you use asynchronous proxy in EJB 3.0 on Jboss AS and does it work as it should? ...

What can I do with EJB?

I'd like to test my knowledge in EJB, making an small application. Could you give me some ideas for doing with EJB? ...

@EJB annotation in clients

Using NetBeans, I do the following in the class containing main(), and it works: import javax.ejb.EJB; public class Master { @EJB TestBeanARemote x; public static void main(String[] args) { Master m = new Master(); m.doStuff(); } //doStuff includes x, but it works, so who cares. ... If I do that in a ...

Are EJBs still useful? And what are the Spring Framework ways to replace EJBs?

I have read for a while that EJBs are not useful or cumbersome. But what other ways implement the business delegate pattern? How do EJBs differ from the approach the Spring recommends? Also, how have recent advances with EJBs changed your opinion. ...

How do you preform an EJB lookup with application security?

I'm trying to lookup an EJB from a standalone java application. I'm thinking in terms of WebSphere Application Server 6.1, but if someone knows how to do this for another application server, it may get me in the right direction. What I'm currently doing: initialContext= new InitialContext(env); initialContext.lookup(""); lc ...

question on EJB and resource injection

I am having problems getting JBoss to inject an environment variable value into a bean. Here is my bean class: package com.topcoder.test; import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; import javax.ejb.EJBContext; import javax.ejb.Remote; import javax.ejb.SessionContext; import javax.ejb.Stateles...

EJB and Synchronization

Are Session Beans (stateless session beans, stateful session beans) Synchronized? ...

How to get the EJB listening port?

I'm currently developing a library for monitoring calls to several remote services (WebServices, EJBs...). One of the parameters that i would like to register is the port from which a EJB is called (a Stateless Session Bean invoked like a remote object) There is any standarised way of getting the port? Or should I inspect the JNDI tre...

EJB - confused about Home/Remote -- LocalHome/Local interfaces

Revising some past exam papers for an exam mainly focus on component-oriented design and J2EE, I have come across the following question: A preliminary investigation of scenario 3: “Exchange Request” suggests that two EJBs will provide a suitable solution: a session bean called EnterExchangeRequest to control the processing and an entit...

Custom joins entitys on Hibernate

We have a Hibernate based system with Annotations. Our entities have a custom property DELETED. We have to select non deleted entities with non deleted sub-entities. How can we can do it? Little sample for describe the situation: GenericEntity { ... @Basic @Column(name = DELETED) protected Boolean deleted = false; @...

Java EJB entity beans performance

How performant is the entity bean? Would it be too much to ask if I want 1000 objects per table (probably about 20 tables) across 5 processes where some processes might be changing the objects as often as 60 times a second? Are there any resources out there on the limitations of the entity bean? Thanks for any help! ...