How can i use prelogin event or the customizer?. I'm creating a
entity manager in the beginning and the login info is in the
persistence.xml.
2012/1/23 Christopher Delahunt <
christopher.delahunt@oracle.com
<mailto:christopher.delahunt@oracle.com>>
The code also suggested you were adding a descriptor to an
active session or to the query directly. Descriptors should
only be added to a session prior to login as they require
session initialization to function correctly.
Try using a prelogin event or customizer to add your descriptor
to the session.
On 23/01/2012 10:36 AM, Tom Ware wrote:
I don't recommend using NoIdentityMap.
The previous exception was missing the the initial lines.
Can you please
send it again?
-tom
On 23/01/2012 9:20 AM, Luis Dominguez wrote:
Hi folks.
Using descriptor.useNoIdentityMap() fixed the previous
problem. But,
this is the
new error message:
java.lang.NullPointerException
at
org.eclipse.persistence.__internal.security.__PrivilegedAccessHelper.__getMethodParameterTypes(__PrivilegedAccessHelper.java:__323)
at
org.eclipse.persistence.__internal.descriptors.__MethodAttributeAccessor.__getSetMethodParameterType(__MethodAttributeAccessor.java:__168)
at
org.eclipse.persistence.__internal.descriptors.__MethodAttributeAccessor.__getSetMethodParameterType(__MethodAttributeAccessor.java:__156)
at
org.eclipse.persistence.__internal.descriptors.__MethodAttributeAccessor.__setAttributeValueInObject(__MethodAttributeAccessor.java:__282)
at
org.eclipse.persistence.__internal.descriptors.__MethodAttributeAccessor.__setAttributeValueInObject(__MethodAttributeAccessor.java:__226)
I read about the security permissions. I setted
permission java.lang.reflect.__ReflectPermission
"suppressAccessChecks";
permission java.lang.RuntimePermission
"accessDeclaredMembers";
permission java.lang.RuntimePermission "getClassLoader";
permission java.lang.RuntimePermission
"getMethodParameterTypes";
in my JVM, but anything changed.
Help.
2012/1/20 Luis Dominguez <
ldominguez.integra@xxxxxxxxx
<mailto:
ldominguez.integra@gmail.com>
<mailto:ldominguez.integra@__gmail.com
java.util.concurrent.__ConcurrentHashMap.get(__ConcurrentHashMap.java:768)
at
org.eclipse.persistence.__internal.identitymaps.__IdentityMapManager.__getIdentityMap(__IdentityMapManager.java:923)
at
org.eclipse.persistence.__internal.identitymaps.__IdentityMapManager.__acquireLock(__IdentityMapManager.java:144)
at
org.eclipse.persistence.__internal.sessions.__IdentityMapAccessor.__acquireLock(__IdentityMapAccessor.java:92)
at
org.eclipse.persistence.__internal.sessions.__IdentityMapAccessor.__acquireLock(__IdentityMapAccessor.java:83)
at
org.eclipse.persistence.__internal.sessions.__AbstractSession.__retrieveCacheKey(__AbstractSession.java:4567)
at
org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.buildObject(__ObjectBuilder.java:668)
at
org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.__buildWorkingCopyCloneNormally(__ObjectBuilder.java:612)
at
org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.__buildObjectInUnitOfWork(__ObjectBuilder.java:565)
at
org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.buildObject(__ObjectBuilder.java:497)
at
org.eclipse.persistence.__internal.descriptors.__ObjectBuilder.buildObject(__ObjectBuilder.java:456)
at
org.eclipse.persistence.__queries.ObjectLevelReadQuery.__buildObject(__ObjectLevelReadQuery.java:723)
at
org.eclipse.persistence.__queries.ReadAllQuery.__registerResultInUnitOfWork(__ReadAllQuery.java:742)
at
org.eclipse.persistence.__queries.ReadAllQuery.__executeObjectLevelReadQuery(__ReadAllQuery.java:423)
at
org.eclipse.persistence.__queries.ObjectLevelReadQuery.__executeDatabaseQuery(__ObjectLevelReadQuery.java:__1080)
at
org.eclipse.persistence.__queries.DatabaseQuery.execute(__DatabaseQuery.java:808)
at
org.eclipse.persistence.__queries.ObjectLevelReadQuery.__execute(ObjectLevelReadQuery.__java:1040)
at
org.eclipse.persistence.__queries.ReadAllQuery.execute(__ReadAllQuery.java:383)
at
org.eclipse.persistence.__queries.ObjectLevelReadQuery.__executeInUnitOfWork(__ObjectLevelReadQuery.java:__1126)
at
org.eclipse.persistence.__internal.sessions.__UnitOfWorkImpl.__internalExecuteQuery(__UnitOfWorkImpl.java:2842)
at
org.eclipse.persistence.__internal.sessions.__AbstractSession.executeQuery(__AbstractSession.java:1521)
at
org.eclipse.persistence.__internal.sessions.__AbstractSession.executeQuery(__AbstractSession.java:1503)
at
org.eclipse.persistence.__internal.sessions.__AbstractSession.executeQuery(__AbstractSession.java:1477)
at org.luisd.App.main(App.java:__91)
at
sun.reflect.__NativeMethodAccessorImpl.__invoke0(Native
Method)
at
sun.reflect.__NativeMethodAccessorImpl.__invoke(__NativeMethodAccessorImpl.java:__39)
at
sun.reflect.__DelegatingMethodAccessorImpl.__invoke(__DelegatingMethodAccessorImpl.__java:25)
at java.lang.reflect.Method.__invoke(Method.java:597)
at
com.intellij.rt.execution.__application.AppMain.main(__AppMain.java:120)
And this is what i did:
ClassDescriptor descriptor = new ClassDescriptor();
descriptor.useNoIdentityMap();
ObjectArrayMapping pricesMapping = new ObjectArrayMapping();
pricesMapping .setReferenceClass(PType.__class);
pricesMapping .setAttributeName("pricesList"__);
pricesMapping .setFieldName("PRICES_LIST");
pricesMapping .setStructureName("CT_PRICE");
pricesMapping .readOnly();
pricesMapping .setGetMethodName("__getPricesList");
pricesMapping .setSetMethodName("__setPricesList");
descriptor.addMapping( pricesMapping );
StoredProcedureCall call = new StoredProcedureCall();
call.setProcedureName("PKG.__GET_DEVICES");
call.__useNamedCursorOutputAsResultSe__t("v_list");
call.addNamedArgument("v_id");
call.addNamedArgument("v___class");
call.addNamedArgument("v_date"__);
ReadAllQuery query = new ReadAllQuery();
query.addArgument(" v_id ");
query.addArgument(" v_class ");
query.addArgument(" v_date ");
query.setDescriptor(__descriptor);
query.setCall(call);
List<Object> queryArgs = new ArrayList<Object>();
queryArgs.add(new Long(12));
queryArgs.add("p1");
queryArgs.add(new Timestamp(System.__currentTimeMillis()));
Session activeSession = ((JpaEntityManager)
main.em.getDelegate()).__getActiveSession();
List< PType > queryResultList = (List)
activeSession.executeQuery(__query,
<mailto:tom.ware@xxxxxxxxxx> <mailto:tom.ware@xxxxxxxxxx
<mailto:
tom.ware@xxxxxxxxxx>>>
We have direct support for Arrays that has been around
for quite a
while. (and JPA mapping support starting in EclipseLink 2.3)
Documentation Link:
http://wiki.eclipse.org/____Configuring_an_Object-____Relational_Data_Type_Array_____Mapping_(ELUG)
<http://wiki.eclipse.org/__Configuring_an_Object-__Relational_Data_Type_Array___Mapping_(ELUG)>
<mailto:tom.ware@xxxxxxxxxx>>>>__>
Can you explain a little more about what this custom
type is? We
provide a number of ways you can deal with special
types and
your choice
will depend on how it is derived.
At the simplest level, you can specify a Converter
on the object
that
maps to the special type. That will allow you do do
some
operations.
http://wiki.eclipse.org/Using_________EclipseLink_JPA_____Extensions_%____28ELUG%29#____Using_EclipseLink_____JPA_____Converters
<http://wiki.eclipse.org/Using_______EclipseLink_JPA___Extensions_%____28ELUG%29#__Using_EclipseLink_____JPA___Converters>
<http://wiki.eclipse.org/__Using_____EclipseLink_JPA___Extensions_%____28ELUG%29#__Using_EclipseLink_____JPA___Converters
<http://wiki.eclipse.org/Using_____EclipseLink_JPA_Extensions_%____28ELUG%29#Using_EclipseLink_____JPA_Converters>>
<http://wiki.eclipse.org/____Using___EclipseLink_JPA_____Extensions_%__28ELUG%29#Using_____EclipseLink___JPA_Converters
<http://wiki.eclipse.org/__Using___EclipseLink_JPA___Extensions_%__28ELUG%29#Using___EclipseLink___JPA_Converters>
<http://wiki.eclipse.org/__Using___EclipseLink_JPA___Extensions_%__28ELUG%29#Using___EclipseLink___JPA_Converters
<http://wiki.eclipse.org/Using___EclipseLink_JPA_Extensions_%__28ELUG%29#Using_EclipseLink___JPA_Converters>>>
<http://wiki.eclipse.org/______Using_EclipseLink_JPA_______Extensions_%28ELUG%29#Using_______EclipseLink_JPA_Converters
<http://wiki.eclipse.org/____Using_EclipseLink_JPA_____Extensions_%28ELUG%29#Using_____EclipseLink_JPA_Converters>
http://www.eclipse.org/________eclipselink/api/2.3/index.html
<http://www.eclipse.org/______eclipselink/api/2.3/index.html>
<http://www.eclipse.org/______eclipselink/api/2.3/index.html
<http://www.eclipse.org/____eclipselink/api/2.3/index.html>__>
<http://www.eclipse.org/__eclipselink/api/2.3/index.html>__>__>
<http://www.eclipse.org/eclipselink/api/2.3/index.html>__>__>__>
If the data structure is, in fact, a Struct, you may
be able to
make use
of our StructConverter to operate on it as it enters
and leaves the
database.
http://wiki.eclipse.org/Using_________EclipseLink_JPA_____Extensions_(____ELUG)#How_to_____Use_the_.________40StructConverter_Annotation
<http://wiki.eclipse.org/Using_______EclipseLink_JPA___Extensions_(____ELUG)#How_to___Use_the_.______40StructConverter_Annotation>
<http://wiki.eclipse.org/__Using_____EclipseLink_JPA___Extensions_(____ELUG)#How_to___Use_the_.______40StructConverter_Annotation
<http://wiki.eclipse.org/Using_____EclipseLink_JPA_Extensions_(____ELUG)#How_to_Use_the_.____40StructConverter_Annotation>>
<http://wiki.eclipse.org/____Using___EclipseLink_JPA_____Extensions_(__ELUG)#How_to_____Use_the_.__40StructConverter_____Annotation
<http://wiki.eclipse.org/__Using___EclipseLink_JPA___Extensions_(__ELUG)#How_to___Use_the_.__40StructConverter___Annotation>
<http://wiki.eclipse.org/__Using___EclipseLink_JPA___Extensions_(__ELUG)#How_to___Use_the_.__40StructConverter___Annotation
<http://wiki.eclipse.org/Using___EclipseLink_JPA_Extensions_(__ELUG)#How_to_Use_the_.__40StructConverter_Annotation>>>
<http://wiki.eclipse.org/______Using_EclipseLink_JPA_______Extensions_(ELUG)#How_to_Use_______the_.40StructConverter_______Annotation
<http://wiki.eclipse.org/____Using_EclipseLink_JPA_____Extensions_(ELUG)#How_to_Use_____the_.40StructConverter_____Annotation>
main.em.getDelegate()).________getActiveSession().________executeQuery(query,
queryArgs);
recovers a list of DatabaseRecord, with a field as
[Ljava.lang.Object;@10010ec
object. When i'm trying to iterate this array,
only have a
[Ljava.lang.Object;,
with no possibilities of see the data.
How i can do that?
_______________________________________________________
<mailto:eclipselink-users@ <mailto:eclipselink-users@>
<mailto:eclipselink-users@
<mailto:eclipselink-users@>>__e__c__lipse.org
<http://ec__lipse.org> <http://eclipse.org>
https://dev.eclipse.org/________mailman/listinfo/eclipselink-________users
<https://dev.eclipse.org/______mailman/listinfo/eclipselink-______users>
_______________________________________________________
<mailto:eclipselink-users@ <mailto:eclipselink-users@>
<mailto:eclipselink-users@
<mailto:eclipselink-users@>>__e__c__lipse.org
<http://ec__lipse.org> <http://eclipse.org>
https://dev.eclipse.org/________mailman/listinfo/eclipselink-________users
<https://dev.eclipse.org/______mailman/listinfo/eclipselink-______users>