Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] Virtual Metlhods | questions

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.

Back to the top