ejb-3.0

How can I avoid the Warning “firstResult/maxResults specified with collection fetch; applying in memory!” when using Hibernate?

送分小仙女□ 提交于 2019-11-30 01:35:02
I'm getting a warning in the Server log "firstResult/maxResults specified with collection fetch; applying in memory!" . However everything working fine. But I don't want this warning. My code is public employee find(int id) { return (employee) getEntityManager().createQuery(QUERY).setParameter("id", id).getSingleResult(); } My query is QUERY = "from employee as emp left join fetch emp.salary left join fetch emp.department where emp.id = :id" Reason for this warning is that when fetch join is used, order in result sets is defined only by ID of selected entity (and not by join fetched). If this

Successful build in Maven still showing errors in Eclipse

為{幸葍}努か 提交于 2019-11-29 23:52:12
I'm having something quite peculiar here, my build is successful in maven when I type "mvn clean install" however once imported into Eclipse it's showing errors. See for yourself: I guess exluding quartz from the `pom.xml solved the problem but I'd like to know why. PS: Here is the pom.xml in case you want to see it: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.thongvan.mpclient</groupId>

WebSphere 7. Inject EJB from another application

岁酱吖の 提交于 2019-11-29 23:21:36
I am trying to inject an EJB with the @EJB annotation: when I inject an EJB into another EJB in the same ear it works fine. when I inject an EJB into another EJB from another ear in the same server I get an exception: EJB threw an unexpected (non-declared) exception during invocation of method "sayHello". Exception data: javax.ejb.EJBException: Injection failure; nested exception is: com.ibm.ejs.container.EJBNotFoundException: EJB with interface com.mycompany.myapp.ejb.test2 not present in application myapp1 I'm using WebSphere 7 and EJB 3.0. When I'm doing a jndi lookup myself, it works fine.

Why do we need separate Remote and Local interfaces for EJB 3.0 session beans

风格不统一 提交于 2019-11-29 20:37:08
I was wondering why do we need separate Remote and Local intefaces for EJB 3.0 Session beans. I guess most of the time they would both be defining the same contract. Why cant I have a common interface and in my Bean I should just be able to say that I want this bean to be accessed remotely and/or locally. thanks Vikas This is what the EJB spec says: The choice between the local and the remote programming model is a design decision that the Bean Provider makes when developing the enterprise bean. While it is possible to provide both a remote client view and a local client view for an enterprise

EJB 3.1 or Spring 3.. When to choose which one?

試著忘記壹切 提交于 2019-11-29 19:58:04
EJB achieved many improvements in 3.x versions, Spring is also commonly used and version 3 is a good alternative. There are many articles on web, but no exact comparison about ejb3x versus spring3x.. Do you have any ideas about them, in real world examples which one is better at which conditions? For example, we want to separate db and server, which means our application will be on a server, our database will be in another server.. EJB remoting vs Cluster4Spring etc ? Doing everyting @Annotation is always good? configuration never needed? For your use case where the application runs on one

Doubt regarding JPA namedquery

假装没事ソ 提交于 2019-11-29 18:44:39
I am trying to execute a namedquery @NamedQuery(name="getEmployeeDetails",query="select e.username,e.email,e.image,e.firstname,e.lastname from Employee e where e.empid=?1") Now when I execute this query in a EJB 3.0 Session Bean what is the object I should return.I tried returning Listits returning a Vector which creates a classcast exception.The employee table contains fields like password and other confidential details which I don't want to fetch.So I am not using select e from Employee e . I am learning JPA can anyone help. Below is the sample query which fetches only the required fields,

EJB stateless session beans and stateful session bean

左心房为你撑大大i 提交于 2019-11-29 15:52:43
问题 I have gone through various books on stateful and stateless session bean and how they work. I want to know the real usage of these ejbs and advantages over using plain java classes. Basically when do you go for stateless ejbs and when do you go for stateful ejbs. I want a real time application. 回答1: the usage of these type of ejbs are usually in service layer as service classes. EJB3 stateless and stateful bean are actually POJO (with some annotations) and they don't have any big difference

JPA and Table Views. Can it be done? [duplicate]

拥有回忆 提交于 2019-11-29 11:06:21
问题 This question already has an answer here: Does JPA support mapping to sql views? 3 answers We currently have a Java EE system where we are mapping to our database using JPA. It is a fairly well developed system with about 20 entities. We now have been ordered to use Views for everything. Eg: if we have a table called PERMISSION then we also need a view called PERMISSION_VIEW . Basically we need to do this to every table, and our applications can only access the data by querying the view. Now

How is the return-value of SessionContext.getBusinessObject() different from 'this' keyword used in the bean?

此生再无相见时 提交于 2019-11-29 10:44:43
The SessionContext.getBusinessObject() is described in the docs as follows, Obtain an object that can be used to invoke the current bean through the given business interface. Parameters: businessInterface - One of the local business interfaces or remote business interfaces for this session bean. Returns: The business object corresponding to the given business interface. Can't I use the 'this' keyword in Java instead, to accomplish the same ? How are these different ? The motivation here is that most EJB implementations work on proxies. You wouldn't be too far off in thinking of it as old

Glassfish 2.1 EJB 3.0 Exposing local EJB to other applications running in the same domain/jvm

佐手、 提交于 2019-11-29 10:33:19
I have an existing project that I am in need of configuring different. This needs to happen without major code changes. I am actually hoping I could somehow do this only with configuration. I have spent the past 2 to 3 days reading everything I can find on this issue. I understand the glassfish classloaders, and what is available to me. I have a current sample project that has an EJB which defines a @Local interface. The ejb is deployed inside an ejb-module as an ejb-module into the glassfish domain. Now I am trying to find a way for another application which was deployed as an ear into the