Skip to main content

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

When I test the persistImageInfoIntoImageLibrary method, I noticed it also works without beginning a transaction. ImageInfo imageInfo = getImageInfo();
    imageDAO.persistImageInfoIntoImageLibrary(imageInfo);

The image is persisted in the table and I didn't started a transaction.
How is this possible?

Can someone explain this to me?
Leon


Leon Derks wrote:
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();
}
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


__________ NOD32 3551 (20081024) Informatie __________

Dit bericht is gecontroleerd door het NOD32 Antivirus Systeem.
http://www.nod32.nl






Back to the top