sf logo

sf.qof.session
Annotation Type UseSessionContext


@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();
 }
 

See Also:
SessionContext, SessionContextFactory

Optional Element Summary
 String name
          This is the session context name It defaults to the default session context name.
 

name

public abstract String name
This is the session context name It defaults to the default session context name.

Returns:
session context name
Default:
"DEFAULT_CONTEXT"

sf logo

Copyright © 2007 brunella ltd. All Rights Reserved.