Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [eclipselink-users] Rading Functionresult from a DataModifyQuery

I didn’t realized, that I’m using EntityManager as Application Managed. So I missed to close it.

Now, that I have solved my Issue, it works with the exclusiveconnection-mode perfectly.

Thanks a lot.

 

Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von Andrei Ilitchev
Gesendet: Montag, 6. Juli 2009 17:54
An: EclipseLink User Discussions
Betreff: Re: [eclipselink-users] Rading Functionresult from a DataModifyQuery

 

Please describe the scenario that caused running out of Sessions on The Oracle Database.

That should not happen if you always close enttity managers after use (entityManager.close())

 

 

To process outputParametersDetected event:

in SessionCustomizer add event listener to the session:

 

session.getEventManager().addListener(new MyListener());

 

where:

 

public class MyListener extends org.eclipse.persistence.sessions.SessionEventAdapter { 

    public void outputParametersDetected(org.eclipse.persistence.sessions.SessionEvent event) {

        Object value = ((Map)event.getResult()).get(("FUNCTION_RESULT");

    }

}

----- Original Message -----

Sent: Monday, July 06, 2009 9:52 AM

Subject: AW: [eclipselink-users] Rading Functionresult from a DataModifyQuery

 

Thanks for your prompt answer.

I had the parameter for exclusive-connection set priviusly but tured  it off egain. I' was running out of Sessions on The Oracle Database..

Is it possible to set the parameter for just the Sesion I'm using for the Functioncall?

Is there a Sample of using the outputParameterDetected event?

 

 

Von: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx] Im Auftrag von Andrei Ilitchev
Gesendet: Montag, 6. Juli 2009 15:23
An: EclipseLink User Discussions
Betreff: Re: [eclipselink-users] Rading Functionresult from a DataModifyQuery

 

I would keep using ValueReadQuery,

pass property "eclipselink.jdbc.exclusive-connection.mode" -> "Always" to createEntityManager method

and ProxyUser connection will be always used.

 

If you use DataModifyQuery then handle outputParametersDetected event that would contain the retuned value.

 

----- Original Message -----

Sent: Monday, July 06, 2009 9:08 AM

Subject: [eclipselink-users] Rading Functionresult from a DataModifyQuery

 

Hello,
I'm using ValueReadQuery with StoredFunctionCall to read the Function result.
Now I have to execute the Function as a DataModifyQuery to force EL use ProxyUser.
Is there a Possibility to set ValueReadQuery to by also a DataModifyQuery?

SampleCode:
    public Object executeFunction(String functionName, HashMap<String, Object> params, boolean modifysData) {
    StoredFunctionCall functionCall = new StoredFunctionCall();
        functionCall.setProcedureName(functionName);
DatabaseQuery query;
if (modifysData) {
//Using DataModifyQuery for Functions which modifies Data on Database
query = new DataModifyQuery();
} else {
//Using ValueReadQuery for Functions which doesn't modifies Data on Database
query = new ValueReadQuery();
}
        query.setCall(functionCall);
        List<Object> args = new ArrayList<Object>();
        for (String key : params.keySet()) {
            functionCall.addNamedArgument(key);
            query.addArgument(key);
            args.add(params.get(key));
        }

       functionCall.setResult("FUNCTION_RESULT");


//Using DataModifyQuery has the effet that the Result is an Integer which (maby) indicates sucsessfull execution and not the Functionresolt it self.
        return getSession().executeQuery(query, args);
    }

Best Regards
Berner Martin
Schweiter Braunviehzuchtverband

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top