Session
Date: 2010-07-30

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.postgresql.pljava
Interface Session

All Known Implementing Classes:
  Session

    public interface Session

A Session maintains transaction coordinated in-memory data. The data added since the last commit will be lost on a transaction rollback, i.e. the Session state is synchronized with the transaction. Please note that if nested objects (such as lists and maps) are stored in the session, changes internal to those objects are not subject to the session semantics since the session is unaware of them.

Method Summary
`void` | `addSavepointListener(SavepointListener listener)` Adds the specified `listener` to the list of listeners that will receive savepoint events.
`void` | `addTransactionListener(TransactionListener listener)` Adds the specified `listener` to the list of listeners that will receive transactional events.
`void` | `executeAsSessionUser(java.sql.Connection conn, java.lang.String statement)` Execute a statement as a session user rather then the effective user.
`java.lang.Object` | `getAttribute(java.lang.String attributeName)` Obtain an attribute from the current session.
`ObjectPool` | `getObjectPool(java.lang.Class cls)` Return an object pool for the given class.
`java.lang.String` | `getSessionUserName()` Return the name of the user that owns the current session.
`java.lang.String` | `getUserName()` Return the name of the effective user.
`void` | `removeAttribute(java.lang.String attributeName)` Remove an attribute previously stored in the session.
`void` | `removeSavepointListener(SavepointListener listener)` Removes the specified `listener` from the list of listeners that will receive savepoint events.
`void` | `removeTransactionListener(TransactionListener listener)` Removes the specified `listener` from the list of listeners that will receive transactional events.
`void` | `setAttribute(java.lang.String attributeName, java.lang.Object value)` Set an attribute to a value in the current session.

Method Detail

### addSavepointListener

    void addSavepointListener(SavepointListener listener)

  Adds the specified `listener` to the list of listeners that will receive savepoint events. This method does nothing if the listener was already added.

  Parameters:
    `listener` - The listener to be added.

### addTransactionListener

    void addTransactionListener(TransactionListener listener)

  Adds the specified `listener` to the list of listeners that will receive transactional events. This method does nothing if the listener was already added.

  Parameters:
    `listener` - The listener to be added.

### getAttribute

    java.lang.Object getAttribute(java.lang.String attributeName)

  Obtain an attribute from the current session.

  Parameters:
    `attributeName` - The name of the attribute
  Returns:
    The value of the attribute

### getObjectPool

    ObjectPool getObjectPool(java.lang.Class cls)

  Return an object pool for the given class. The class must implement the interface `PooledObject`.

  Parameters:
    `cls` -
  Returns:
    An object pool that pools object of the given class.

### getUserName

    java.lang.String getUserName()

  Return the name of the effective user. If the currently executing funciton is declared with `SECURITY DEFINER`, then this method returns the name of the user that defined the function, otherwise, this method will return the same as `getSessionUserName()`.

### getSessionUserName

    java.lang.String getSessionUserName()

  Return the name of the user that owns the current session.

### executeAsSessionUser

    void executeAsSessionUser(java.sql.Connection conn,
                              java.lang.String statement)
                              throws java.sql.SQLException

  Execute a statement as a session user rather then the effective user. This is useful when functions declared using `SECURITY DEFINER` wants to give up the definer rights.

  Parameters:
    `conn` - The connection used for the execution
    `statement` - The statement to execute
  Throws:
    `java.sql.SQLException` - if something goes wrong when executing.
  See Also:
    `Statement.execute(java.lang.String)`

### removeAttribute

    void removeAttribute(java.lang.String attributeName)

  Remove an attribute previously stored in the session. If no attribute is found, nothing happens.

  Parameters:
    `attributeName` - The name of the attribute.

### removeSavepointListener

    void removeSavepointListener(SavepointListener listener)

  Removes the specified `listener` from the list of listeners that will receive savepoint events. This method does nothing unless the listener is found.

  Parameters:
    `listener` - The listener to be removed.

### removeTransactionListener

    void removeTransactionListener(TransactionListener listener)

  Removes the specified `listener` from the list of listeners that will receive transactional events. This method does nothing unless the listener is found.

  Parameters:
    `listener` - The listener to be removed.

### setAttribute

    void setAttribute(java.lang.String attributeName,
                      java.lang.Object value)

  Set an attribute to a value in the current session.

  Parameters:
    `attributeName` -
    `value` -

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2003, 2004, 2005 TADA AB - Taby Sweden. \ Distributed under the terms shown in COPYRIGHT