ejb-3.1

How to get all EJB timers?

穿精又带淫゛_ 提交于 2019-11-30 23:40:12
问题 In EJB 3.1 I can get all timers for a specific bean using TimerService#getTimers() on the TimerService instance obtained for that bean. What I actually need however is a system-wide version of this. I.e. I would like to have a list of all Timers in the EJB container. Is something like that possible? 回答1: There simply is no official API for this in EJB 3.1. If you're only using annotations and/or interfaces to mark your timeout method, you could do a run-time walk over all classes on the class

Why merging is not cascaded on a one to many relationship

匆匆过客 提交于 2019-11-30 17:28:21
My question here is almost similar to my other question Explicit delete on JPA relationships but I thought of simplifying it further to warrant more detailed answers. Imagine I have a OneToMany relationship between a parent and a child. @Entity public class Parent { private String name; @OneToMany(mappedBy="owner",cascade=CascadeType.ALL, fetch=FetchType.EAGER) private List<Child> children; } @Entity public class Child { private String name; @ManyToOne private Parent owner; } In my UI, I am showing a list of parent. User can choose one parent and he/she can edit the list of its children. To

Why merging is not cascaded on a one to many relationship

断了今生、忘了曾经 提交于 2019-11-30 16:39:51
问题 My question here is almost similar to my other question Explicit delete on JPA relationships but I thought of simplifying it further to warrant more detailed answers. Imagine I have a OneToMany relationship between a parent and a child. @Entity public class Parent { private String name; @OneToMany(mappedBy="owner",cascade=CascadeType.ALL, fetch=FetchType.EAGER) private List<Child> children; } @Entity public class Child { private String name; @ManyToOne private Parent owner; } In my UI, I am

@JsonIgnore and @JsonBackReference are being Ignored

故事扮演 提交于 2019-11-30 14:12:24
问题 I'm working with RestEasy, Jboss 7 and EJB 3.1. I'm creating a RESTful web service that returns data in JSON format. The problem is that I have a @ManyToOne relationship on one of my entities which causes an infinite recursion during serialization. I tried using Jackson's @JsonIgnore and @JsonBackReference annotations to fix the problem but it seems as if they are being totally ignored and the infinite recursion is still occurring. This is my User Class: class User { private String userId;

EJB 3.1 container managed concurrency vs. synchronized

走远了吗. 提交于 2019-11-30 13:59:37
问题 I've started reading about the singleton session bean and the annotations used to employ container managed concurrency. I don't see the benfit of this compared to simply using the 'synchronized' keyword, so I suspect there is something important I am missing. Consider this example from the book "Enterprise JavaBeans 3.1" by Rubinger & Burke, O'Reilly: @javax.ejb.Lock(javax.ejb.LockType.READ) public String concurrentReadOnlyMethod(){...} @javax.ejb.Lock(javax.ejb.LockType.WRITE) public void

WELD-001408 Unsatisfied dependencies when injecting EJBs that implement interfaces

旧巷老猫 提交于 2019-11-30 12:54:39
问题 Here is the situation. I've got the following interfaces: public interface Parent { } public interface ChildOne extends Parent { } public interface ChildTwo extends Parent { } and 2 EJBs: @Stateless public class FirstBean implements ChildOne { } @Stateless public class SecondBean implements ChildTwo { } And also this CDI Bean: @Named @SessionScoped public class TestController implements Serializable { @Inject private FirstBean firstBean; @Inject private SecondBean secondBean; } While trying

Can the EJB 3.1 @Schedule be configured outside of the application code?

不羁岁月 提交于 2019-11-30 12:35:24
问题 How can I configure a schedule intervals: @Schedule(persistent=true, minute="*", second="*/5", hour="*") outside of the application code? How can I configure it in ejb-jar.xml? Can I configure it outside the application (kind of properties file)? 回答1: Here is an example of a scheduling in the deployment descriptor: <session> <ejb-name>MessageService</ejb-name> <local-bean/> <ejb-class>ejb.MessageService</ejb-class> <session-type>Stateless</session-type> <timer> <schedule> <second>0/18</second

Inject Spring beans into EJB3

时光总嘲笑我的痴心妄想 提交于 2019-11-30 12:16:28
问题 I'm trying to inject Spring beans into an EJB using @Interceptors(SpringBeanAutowiringInterceptor.class) but I cannot get it working with the beanRefContext.xml examples I've seen. Here's my EJB: @Stateless @Interceptors(SpringBeanAutowiringInterceptor.class) public class AlertNotificationMethodServiceImpl implements AlertNotificationMethodService { @Autowired private SomeBean bean; } I've provided a beanRefContext.xml as follows: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="..."> <!-

@JsonIgnore and @JsonBackReference are being Ignored

北城余情 提交于 2019-11-30 09:48:34
I'm working with RestEasy, Jboss 7 and EJB 3.1. I'm creating a RESTful web service that returns data in JSON format. The problem is that I have a @ManyToOne relationship on one of my entities which causes an infinite recursion during serialization. I tried using Jackson's @JsonIgnore and @JsonBackReference annotations to fix the problem but it seems as if they are being totally ignored and the infinite recursion is still occurring. This is my User Class: class User { private String userId; private Role role; @Id @Column(name = "\"UserId\"", unique = true, nullable = false, length = 30) public

Jetty 8 + EJB 3.1 + JTA + CDI + JPA 2 stack?

我是研究僧i 提交于 2019-11-30 09:23:33
Can anyone tell me if it is currently possible to "glue together" a partial Java EE 6 Web Profile over Jetty? I've found a lot of articles about integrating standalone EJB 3 containers, JTA providers, etc with older Jetty versions, so I wounder if I could make it all work together. I would like to assemble a Servlet 3.0 + CDI + EJB 3.1 + JTA (if needed, all I really want is declarative transaction management) + JPA 2 environment over Jetty 8 (or Tomcat 7 if no Jetty alternatives are available). My questions are: Can it be done? Has anyone managed to do that? Any articles about getting OpenEJB,