public class DBCommandListener extends CommandListener
Basewill be used to open a connection.
This class will open a new connection, start a new transaction and will execute the command.
After that, the transaction will be committed. In case execution of a command fails,
the transaction will be rolled back and command and exception wil be passed to
method, where a subclass can process them further. The connection will be closed regardless of outcome.
|Constructor and Description|
Use this constructor to open a connection using a set of properties from "database.properties" file according to current ACTIVE_ENV environment (development, production, etc.).
JNDI string to open a connection from a pool.
|Modifier and Type||Method and Description|
Override in subclasses to handle exceptions.
public DBCommandListener(String jndiConnection)
jndiConnection- JDBC connection string.
public <T extends Command> void onCommand(T command)
command- command to execute.
Copyright © 2016. All rights reserved.