Questions tagged [ejb-3.0]

This tag is used for question related to the session bean and message-driven bean component types of the EJB 3.0 programming model. For questions about the persistent entities defined in the document "Java Persistence API" of the EJB 3.0 specification, use the [JPA] tag.

JSR 220: Enterprise JavaBeans 3.0

The Enterprise JavaBeans architecture is a component architecture for the development and deployment of component-based business applications.

The purpose of Enterprise JavaBeans (EJB) 3.0 is to improve the EJB architecture by reducing its complexity from the developer's point of view.

The goal of EJB 3.0 is to target ease of development, the main theme of the Java EE 5 platform release. EJB 3.0 is a major simplification over the APIs defined by the EJB 2.1 and earlier specifications. The simplified EJB 3.0 API allows developers to program EJB components as ordinary Java objects with ordinary Java business interfaces rather than as heavy weight components. Both component and client code are simplified, and the same tasks can be accomplished in a simpler way, with fewer lines of code. Because it is much simpler, EJB 3.0 is also much faster to learn to use than EJB 2.1.

2345 questions
562
votes
14 answers

What is the difference between DAO and Repository patterns?

What is the difference between Data Access Objects (DAO) and Repository patterns? I am developing an application using Enterprise Java Beans (EJB3), Hibernate ORM as infrastructure, and Domain-Driven Design (DDD) and Test-Driven Development (TDD) as…
95
votes
4 answers

Spring vs EJB. Can Spring replace EJB?

Since Spring is able to use transactions just like EJB. For me, Spring is able to replace the requirement of using EJB. Can anyone tell me what are the extra advantages of using EJB?
cometta
  • 35,071
  • 77
  • 215
  • 324
83
votes
10 answers

"detached entity passed to persist error" with JPA/EJB code

I am trying to run this basic JPA/EJB code: public static void main(String[] args){ UserBean user = new UserBean(); user.setId(1); user.setUserName("name1"); user.setPassword("passwd1"); …
zengr
  • 38,346
  • 37
  • 130
  • 192
73
votes
9 answers

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…
Justin Standard
  • 21,347
  • 22
  • 80
  • 89
72
votes
15 answers

java.lang.IllegalStateException: Multiple representations of the same entity with @ManyToMany 3 entities

I have 3 entities with ManyToMany relationships: Role Entity: @Entity public class Role { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer roleID; private String roleName; private String description; …
user1188867
  • 3,726
  • 5
  • 43
  • 69
57
votes
1 answer

Difference between a "jta-datasource" and a " resource-local " datasource?

The terms "jta-datasource" and "resource-local datasource" are a little vague to me. I'm putting down what I am understanding ( or assuming ) and I'd like you to say where I'm right / wrong. The same database can be referred to as a jta-datasource…
stratwine
  • 3,663
  • 2
  • 26
  • 32
54
votes
7 answers

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

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)…
Gnik
  • 7,120
  • 20
  • 79
  • 129
45
votes
4 answers

use of entityManager.createNativeQuery(query,foo.class)

I would like to return a List of Integers from a javax.persistence.EntityManager.createNativeQuery call Why is the following incorrect? entityManager.createNativeQuery("Select P.AppID From P", Integer.class); specifically why do I get "...Unknown…
Jim Ward
  • 529
  • 1
  • 4
  • 5
44
votes
7 answers

sun.reflect.annotation.TypeNotPresentExceptionProxy error when deploy web-ear

When I try to deploy ejd-ear, web-ear on to glassfish server. I added an ejb client dependency in web project. The ejb-ear deploys successfully. But when I try to deploy web-ear, it throws an exception…
Oops
  • 441
  • 1
  • 4
  • 3
44
votes
21 answers

Successful build in Maven still showing errors in Eclipse

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…
Heetola
  • 5,791
  • 7
  • 30
  • 45
42
votes
7 answers

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

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…
asyard
  • 1,743
  • 5
  • 21
  • 43
40
votes
5 answers

Why should we use EJB?

What is EJB, and why we should use it? Please explain in simple language. Thank you.
mriganka3
  • 687
  • 2
  • 11
  • 18
38
votes
2 answers

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…
ruwan.jayaweera
  • 1,196
  • 3
  • 11
  • 25
38
votes
6 answers

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

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…
Vikas Kedia
  • 648
  • 1
  • 7
  • 9
38
votes
4 answers

Batch inserts using JPA EntityManager

Is there a way where we can use batch inserts using JPA EntityManager. I know there is no direct way to achieve this but there must be some way to achieve this mechanism. Actually, for every insert operation it's taking me 300ms which I want to…
Prathap
  • 1,023
  • 7
  • 19
  • 33
1
2 3
99 100