I've just downloaded glassfish (beta2 - b41d) and run some tests.
If i use a EJB-QL named query to fetch the record specifying a [b]pessimistic-lock[/b] query hint as part of the named query or using setHint then it fails to start a transaction before the query. Which i'm guessing is a bug or would you expect this behaviour?
However now with this version of glassfish/toplink i can specify that the result of a NamedNativeQuery is a class (as well as resultSetMapping) and get the required behaviour - that is a transaction is started before the query.
I'll have a look to see if i can work out why the native query is classed differently.
[Message sent by forum member 'jsl123' (jsl123)]
http://forums.java.net/jive/thread.jspa?messageID=217835