Attempting to set a Business Data List object from a List using a Postgres Connector

Hello,

I am attempting to use the Postgres 9.2 connector to populate a List business variable.

I have a Business Object called ErrorDetail, and have a Pool Business Variable errorDetailList - List

When I try to populate errorDetails using the “takes value of” from my Groovy script I get the following error:

javax.persistence.PersistenceException : "org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.company.model.ErrorDetail.persistenceId" javax.persistence.PersistenceException: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.company.model.ErrorDetail.persistenceId

Caused by: org.hibernate.PropertyAccessException: could not get a field value by reflection getter of com.company.model.ErrorDetail.persistenceId

Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Long field com.company.model.ErrorDetail.persistenceId to com.company.model.ErrorDetail

In the script I am doing the following:

List ErrorDetailList = new ArrayList(); while(resultset.next()) { ErrorDetail errorDetail = new ErrorDetail(); // set the contents of errorDetail object. ErrorDetailList.add(errorDetail); } LOGGER.info("Returning from getErrorDetail "); return ErrorDetailList;

Thanks

Hi,

First I want to clarify that, based on your use case description, what will actually happen is that data store in your PostgreSQL database will be duplicated in the database configured for business data.

If you want to duplicate the data, use the “Instantiate with” operation instead of “takes value of”.

What I actually recommend is to migrate your data from your PostgreSQL to the business data database and use the business variable default value and a search query to initialize your business variable (or “takes value of” operation on a task).

Hi,

Thank you for your response. Yes, I am trying to grab a subset of the rows in an error log database.

Your solution would be a good way to handle it, however I cant do that given the current system setup.

Unfortunately setting the “Instantiate With” doesnt seem to resolve the error. Are there any examples of how to set a List in a business variable from either a resultset or an operation?

Thanks