[JBoss Seam] - Testing an @Asynchronous action
by lowecg2004
Hi,
I have added a call to an asynchronous call to one of my actions. When running from testng I get an NPE from the seam.core.Dispatcher where the offending code is trying to dereference a null object. The object in question is:
@Resource TimerService timerService;
After some digging I find that embeddable EJB does not support a timer service. Fine. But I *really* need to be able to test my functionality here, even if it runs synchronously. That brings me to my request - is it possible for any of the following to happen in this scenario (in order of preference):
1. Get my hands on the JBoss 5 Embedded which promises a microcontainer that "can run everything JBoss AS can"?
2. Be able to create a mock TimerService as part of Seam test?
3. Seam to recognise that there is no timerService, issue a big fat warning and ignore @Asynchronous altogether?
Are there any other options I've missed? #1 would be preferable assuming the container is stable enough - anyone know when it is going to be released?. I don't mind having a go at #2, but I could use some direction (like creating and installing an instance of @Resource TimerService for instance);
Best Regards,
Chris.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027933#4027933
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027933
19Â years, 1Â month
[Persistence, JBoss/CMP, Hibernate, Database] - ManyToMany problem: removing referenced records
by nico.ben
Hi,
I am working with ManyToMany annotation and I cannot obtain the behaviour I'd like to. I need for this forum's help.
I have these tables:
SkillTypes:
id_skill_type
...
Operations:
id_operation
...
R_operations_skills:
id_r_operation_skill PK
id_operation FK
id_skill_type FK
In my 2 entity beans (I don't have a EJB for the relation table R_operations_skills) I used these annotations:
Operation.java
@ManyToMany(cascade={CascadeType.REFRESH, CascadeType.PERSIST}, fetch=FetchType.LAZY)
| @JoinTable(name="r_operations_skills",
| joinColumns=@JoinColumn(name="id_operation"),
| inverseJoinColumns=@JoinColumn(name="id_skill_type"))
| @OrderBy("description")
| public List<SkillType> getSkillTypes() {
| return skillTypes;
| }
|
SkillType.java
@ManyToMany(cascade={CascadeType.REFRESH, CascadeType.PERSIST}, fetch=FetchType.LAZY)
| @JoinTable(name="r_operations_skills",
| joinColumns=@JoinColumn(name="id_skill_type"),
| inverseJoinColumns=@JoinColumn(name="id_operation"))
| @OrderBy("description")
| public List<Operation> getOperations() {
| if(operations == null) {
| operations = new ArrayList<Operation>();
| }
| return this.operations;
| }
My problem is that deleting a skill which has relations with operations, the skill is removed from SkillTypes and also records in the relation table are deleted.
I exptected that I cannot delete a skillType used in the relation.
Could you please suggest me how to solve my problem?
Thank u
Nico
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027931#4027931
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027931
19Â years, 1Â month