hai
thanks, am i have flush() after ever update/add/delete operation is that not the correct way.
Code:
/**
* Get the list of all BSIF Adapter details.
* @return the list of all BSIF Adapter details
* @throws ObjectLoadException if there was a problem persisting the data
* @throws TWCSQLException If there was a problem closing the JDBC connection
*/
public List getAllBSIFAdapter() throws ObjectLoadException,
TWCSQLException
{
log.trace("Entry to : getAllBSIFAdapter method.");
log.info("Getting all BSIF Adapter Configuration.");
// Create the Session
log.debug("Open Hibernate Session.");
Session hibernateSession = hibernateSessionHelper.openSession();
List globalConfig = null;
try
{
try
{
// Get all the BSIF Adapter details
log.debug("Quering the Database.");
globalConfig = hibernateSession.createQuery("select globalConfig from GlobalConfigDTO globalConfig").list();
}
finally
{
// Close the Session and the JDBC Connection.
// hibernate. Release the connection mannually using the
// releaseConnection of the Hibernate Helper Class
log.debug("Close the JDBC Databse Connection.");
hibernateSessionHelper.releaseConnection(hibernateSession.close());
}
}
catch (HibernateException e)
{
throw new ObjectLoadException ("Could not get All the Global BSIF configuration details " + "(Caused by:" + e.getMessage() + ")");
}
catch (SQLException e)
{
throw new TWCSQLException("Error closing the JDBC connection while getting the list of BSIF adapters:" + "(Caused by:" + e.getMessage() + ")");
}
log.trace("Exit from : getAllBSIFAdapter method.");
return globalConfig;
}
Then above is the code to get all the records.
Code:
public long addBSIFAdapter(String jmsRequestQueue,
String jmsResponseTopic,
String jmsNotificationRequestTopic,
String jmsNotificationResponseQueue,
int jmsMessageTimeout,
int processingTimeOut,
int threadReconnectTime,
int maintenanceWindowStartTime,
int maintenanceWindowEndTime,
String maintenanceWindowTimezone)
throws ObjectCreationException, TWCSQLException
{
log.trace("Entry to : addBSIFAdapter method with parameter(s) " + jmsRequestQueue + "," + jmsResponseTopic + "," + jmsNotificationRequestTopic + "," + jmsNotificationResponseQueue + "," + jmsMessageTimeout + "," + processingTimeOut + "," + threadReconnectTime + "," + maintenanceWindowStartTime + "," + maintenanceWindowEndTime + "," + maintenanceWindowTimezone);
log.info("Adding a new Global BISF Adapter Configuration Details");
// Create the GlobalConfigDTO to store the Global Adapter Configuration Details
GlobalConfigDTO globalConfig = new GlobalConfigDTO();
Long instanceID = null; // The generated id for the added configuration
// Add the global Configuration information
log.debug("Initialize the globalConfig Object.");
globalConfig.setJMSRequestQueue(jmsRequestQueue);
globalConfig.setJMSResponseTopic(jmsResponseTopic);
globalConfig.setJMSNotificationRequestTopic(jmsNotificationRequestTopic);
globalConfig.setJMSNotificationResponseQueue(jmsNotificationResponseQueue);
globalConfig.setMaintenanceWindowStartTime(maintenanceWindowStartTime);
globalConfig.setMaintenanceWindowEndTime(maintenanceWindowEndTime);
globalConfig.setMaintenanceWindowTimezone(maintenanceWindowTimezone);
if (!globalConfig.setJMSMessageTimeout(jmsMessageTimeout))
{
throw new ObjectCreationException ("Invalid value provied for the JMS Message Time out, Should be between 1 and 240");
}
if (!globalConfig.setProcessingTimeOut(processingTimeOut))
{
throw new ObjectCreationException ("Invalid value provied for the Processing Time out, Should be between 1 and 290");
}
if (!globalConfig.setThreadReconnectTime(threadReconnectTime))
{
throw new ObjectCreationException ("Invalid value provied for the Thread Reconnect Time, Should be greater than or equal to 1");
}
// Create the Session
log.debug("Open Hibernate Session.");
Session hibernateSession = hibernateSessionHelper.openSession();
try
{
try
{
// Persist the BSIF Adapter Configuration information
log.debug("Persist the BSIF Adapter Configuration information");
instanceID = (Long) hibernateSession.save(globalConfig);
hibernateSession.flush(); // Flush out the configuration
}
finally
{
// Close the Session and the JDBC Connection.
log.debug("Close the JDBC Databse Connection.");
hibernateSessionHelper.releaseConnection(hibernateSession.close());
}
}
catch (HibernateException e)
{
throw new ObjectCreationException ("Could not save Global BSIFAdapter configuration Object: " + "(Caused by:" + e.getMessage() + ")");
}
catch (SQLException e)
{
throw new TWCSQLException("Error closing the JDBC connection while adding new BSIF Adapter Configuration" + e.getMessage());
}
log.trace("Exit from : addBSIFAdapter method with parameter(s) " + jmsRequestQueue + "," + jmsResponseTopic + "," + jmsNotificationRequestTopic + "," + jmsNotificationResponseQueue + "," + jmsMessageTimeout + "," + processingTimeOut + "," + threadReconnectTime + "," + maintenanceWindowStartTime + "," + maintenanceWindowEndTime + "," + maintenanceWindowTimezone);
return instanceID.longValue(); // return the generated id
}
now when i add a record manually the getXXX() is not getting the record added from the backend.