| Re: [eclipselink-users] Virtual Metlhods | questions |
|
Gaurav, To use indirection set: oneToOneMapping.useBasicIndirection() Also, read and write transformers are used and specified on a TransformationMapping. Not sure I completely understand your question and their usage with the attribute accessor. The accessor is used to retrieve the value from the object into the mapping. The mapping can then apply any transformations or conversions. When using a DirectToFieldMapping you could use a converter on the mapping. Cheers, Guy On 17/07/2012 3:39 AM, Gaurav Malhotra wrote: Hi All, I am trying to specify DirectToFieldMapping, OneToMapping and OneToManyMapping in the session customizer. Let's take a example of OneToOneManyMapping . I am setting up the OneToOneMapping as follows. Currently I am specifying "do not use indirection". Is it possible to specify - IndirectionPolicy and make sure the relationship uses ValueHolder (lazy initialization). I will be great if somebody can point me to sample code to achieve this.I want to programatically weave in the lazy loading value holder code. private void oneToOneMapping(ClassDescriptor classDescriptor) { OneToOneMapping OneToOneMapping(); oneToOneMapping.setDescriptor(classDescriptor); oneToOneMapping.setCascadeAll(true); oneToOneMapping.dontUseIndirection(); VirtualAttributeAccessor virtualAttributeAccessor2 = new VirtualAttributeAccessor(); virtualAttributeAccessor2.setAttributeName("phoneNumber"); virtualAttributeAccessor2.setGetMethodName("get"); virtualAttributeAccessor2.setSetMethodName("set"); virtualAttributeAccessor2.initializeAttributes(classDescriptor.getJavaClass()); oneToOneMapping.setAttributeAccessor(virtualAttributeAccessor2); oneToOneMapping.setAttributeName("phoneNumber"); oneToOneMapping.setReferenceClass(PhoneNumber.class); oneToOneMapping.setForeignKeyFieldName("PHONE_NUMBER_ID"); Vector |