|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value=TYPE) public @interface UseSessionContext
Specifies that the connection of the query object should be aquired from
a session context.
It allows to specify a session context name that is used in the implementation
of the getConnection()
method in the query object.
@UseSessionContext(name = "PERSON_CONTEXT") public interface PersonQuery implements BaseQuery { @Query(sql = "select id {%%.id,%%*}, name {%%.name} from person where id = {%1}") Map<Integer, Person> getPerson(int id); }
This specifies that the session context with the name "PERSON_CONTEXT"
should be used. The implementation of getConnection()
will look
similar to this:
public Connection getConnection() { return SessionContextFactory.getContext("PERSON_CONTEXT").getConnection(); }
SessionContext
,
SessionContextFactory
Optional Element Summary | |
---|---|
String |
name
This is the session context name It defaults to the default session context name. |
public abstract String name
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |