Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
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_ = new 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 databaseFields = new Vector(); databaseFields.add("PHONE_NUMBER_ID"); oneToOneMapping.setForeignKeyFieldNames(databaseFields); classDescriptor.getMappings().add(oneToOneMapping); } Another question ============= Is it possible to specify Reader/WriterTrasnformer with VirtualMethods. That is, to apply Reade/WriteTransformer to the attributes in the extension Map. NOTE > In my use case, extension attributes can be DirectToFieldMapping/OneToOne/OneToMany attributes which I am making it programatically in the session customization phase. ~GM

View this message in context: Virtual Metlhods | questions
Sent from the EclipseLink - Users mailing list archive at Nabble.com.


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

--

Oracle
Guy Pelletier

ORACLE Canada, 45 O'Connor Street Suite 400 Ottawa, Ontario Canada K1P 1A4

Green
            Oracle Oracle is committed to developing practices and products that help protect the environment


Back to the top