Win a copy of Rust Web Development this week in the Other Languages forum!

Jun Liu

+ Follow
since Nov 15, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jun Liu

I am working on the Part 2 assignment. When drawing the deploy diagram, I am wondering if we need to show the protocols between servers.

[Edit: removed assignment details question]
The exception said there is no persistence provider for the entity manager. Persistence provider should be defined in persistence.xml as:

Here I am using the EclipseLink as my persistence provider. Please check if your persistence.xml constains <provider> element under <persistence-unit>
If using CMT, MDB can only have REQUIRED and NOT_SUPPORTED. The message can only be redelivered when there is a transaction and the transaction has been rolled back. RuntimeException can cause a transaction to be rolled back. So we need to ensure there is a transaction. If using NOT_SUPPORT, there won't be a transaction. So we can only use REQUIRED.

If using BMT, see the ejbcore spec 5.4.12:

When a message-driven bean using bean-managed transaction demarcation uses the javax.transaction.
UserTransaction interface to demarcate transactions, the message receipt that causes
the bean to be invoked is not part of the transaction.

So the transaction rollback won't cause the message to be redelivered.
When I try to remember what kind of bean can use what transaction attribute, I found something confusing. The spec points out a stateful session bean that implements the SessionSynchronization can use Required, RequiresNew and Mandatory, but don't mentioned what a "plain" stateful session bean can use, that is, a stateful session bean that does not implement the SessionSynchronization. Also the Mastering EJB 3.0 also said stateless session bean can use all the attribute, and stateful session bean implements SessionSynchronization can use that three, but didn't mention a plain stateful session bean. What's about this?

To avoid this we use joinTransaction( ). Correct?

No. joinTransaction() is a method of EntityManager. It allows the EntityManager created outside the transcation can join the current transaction. It has nothing to do with the discussion of BMT here.
So the second item that stateless session bean can only use TRANSACTION scope persistence context is wrong, right? It can uses EXTENDED persistence scope, as long as calling em.close() in every method.
I am quite confused by the combination of the bean type and persistence context scope and type. As I know, the following two points are correct:
1. application-managed persistence context is always EXTENDED scope.
2. stateless session bean and message-driven bean can only use TRANSACTION scope persistence context.

The conclusion from these two points is that stateless session bean can not use application-managed persistence context. But I do see such code in EJB3 spec, such as in ejb 3 persistence spec.
As said above, unidirectional OneToMany can not use foreign key mapping in current JPA. Instead a join table should be used. So the tables should be Person(ID, NAME), Car(ID, CAR_NAME) and Person_Car(PERSON_ID, CAR_ID).
This question actually has two pairs, A or B, C or D. For the first pair, I am not sure. For the second pair, take the example of JMS MessageListner, the onMessage(Message msg) need the JMS message type. So it actually distinguish the message type, which is a javax.jms.Message.

The thing that is confusing here is almost all the examples for MDB is using JMS MessageListener, so our thinking is confined on it. And JMS has its own message types, ObjectMessage, TextMessage and so on. MDB can not distinguish these types. But the "message type" here means a bigger scope. That is, other than JMS, MDB can support other message system.

So for the first pair, the JMS MessageListener only has one method onMessage(). That doesn't mean other message system can only have one method.

Is my understanding right?

Originally posted by Richard Rex:

Related with the above post..

In Stringfun.jsp, I forgot to remove the single/double quotes in the EL.

It should be,

${myString:upper(str)} and

Sorry for that.. But I still get the same problem.

It should be ${myString:upper(param.str)} and ${myString:length(param.str).
Have you added the element <error-page> in web.xml?