Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] autocommit problem

I want to store an image into another db schema, using a stored function call.

I do this by getting the ActiveSession() from my EntityManager, see the Java code below:
In the logging I see the function is executed in eclipselink:

The problem is that the image is already stored into the table, before the transaction has committed. So when I use pl/sql developer and view the table I see that the image is stored without committing the transaction..

The stored function call has no autonomous transaction. So how is this possible?
Does the getActiveSession() has an autocommit?


JAVA CODE:
public ImageInfo persistImageInfoIntoImageLibrary(ImageInfo imageInfo) {
       StoredFunctionCall functionCall = new StoredFunctionCall();
       functionCall.setProcedureName("til.cil_api.create_image");
       functionCall.addNamedArgument("p_image_id");
       functionCall.addNamedArgument("p_image_type_id");
       functionCall.addNamedArgument("p_collection_id");
       functionCall.addNamedArgument("p_description");

       ValueReadQuery query = new ValueReadQuery(functionCall);

       query.addArgument("p_image_id");
       query.addArgument("p_image_type_id");
       query.addArgument("p_collection_id");
       query.addArgument("p_description");

       List args = new ArrayList();
       args.add(null);
       args.add(GuideControlConfiguration.getImageTypeId());
       args.add(GuideControlConfiguration.getImageCollectionId());
       args.add(imageInfo.getVisualElementId());
functionCall.setResult("function_result", Integer.class);

Integer tangeloImageId = (Integer) getActiveSession().executeQuery(query, args);
}

private Session getActiveSession() {
       return ((JpaEntityManager) getEntityManager()).getActiveSession();
}


Back to the top