Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] programmatic customization of mapping meta-data at runtime

Hi Otto,

Is it possible to either weave in a javax.persistence.Transient annotation on the fields that will cause processing to fail, or to map the model with XML to start and add mappings using the Descriptor customization?

-Tom

Olaf Otto wrote:
Hi Tom,

I am aware of the Descriptor customizers, but as far as i know these are invoked after the pre-deployment. Currently, the classes modified by the framework cause the meta-data processing to fail during processORMetadata as they contain non-serializable fields that cannot be persisted (some of them reference custom non-entity types that cannot be serialized).

Thanks and regards,
Olaf

Tom Ware wrote:
Hi Olaf,

There is a model built by our meta data processing that can be changed. In essence, we build a bunch of instances of a class called ClassDescriptor. These ClassDescriptors hold all the mappings we use. We have a mechanism called a DescriptorCustomizer that provides a callback that will allow you to make changes to any of your descriptors. Here is some documentation to get you started.

http://wiki.eclipse.org/Configuring_a_Descriptor_(ELUG)#Configuring_a_Descriptor_Customizer_Class

Although, DescriptorCustomizers are invoked after our meta data processing has executed, I believe you should be able to use them. The idea would be that you allow metadata processing to complete and then customize the descriptors as you see fit. Is there any particular reason why you would like to see the customization mechanism fire before the metadata is processed?


-Tom

Olaf Otto wrote:
Hi Tom,

Thank you for your reply.

Tom Ware wrote:
Hi Olaf,

What kinds of things do you want to do in your meta-data modification?
I think it will mostly be modifying the mapping type of certain fields (for example changing it from basic to N:N or a custom mapping), excluding fields etc.

Depending on what you want to do, there may be several ways to make modifications to the metadata.

1. There is a Customization mechanism that allows you to customize the mappings that are created by our meta-data processing
Very interesting - which specific mechanism are you referring to?
2. There is an event mechanism the provides you with callbacks at certain stages of our initialization
I have seen the event mechanism - but will this actually work before the meta data of the entities has been processed?
3. You can specify your mappings in XML. (with the option of having the XML be the only source of mappings)

I know, but this is not an option, since this would require custom mappings for framework users affecting fields they cannot see. Furthermore, the fields are subject to a lot of changes when altering classes. Basically, i must identify the generated fields by a certain prefix and handle them with regard to their content.
You should also be aware that some performance features in EclipseLink are enabled by byte-code weaving.

Indeed, i have seen that using the eclipse agent has a lot of advantages. But there are a lot of complications with java agents and the framework i don't wish to address by now.
-Tom

Regards,
Olaf

Olaf Otto wrote:
Hello eclipse users!

I have a framework that makes massive use of aspect-oriented programming and code generation. This includes a significant amount of additional fields being created in various classes (of a project using the framework, not in the framework itself) by a java agent at class loading time. These fields are primarily generated for internal framework purposes and are thus invisible to a framework user.

Most of these fields are references to non-serializable resp. custom types and must be handled in a non-standard fashion for persistence.

Now here is the question: Is there a way to hook into the meta-data processing occurring during predeployment? More precisely, i would like to access and modify the persistence meta-data of entities before processor.processORMMetadata() is invoked in the processORMetadata of the PersistenceUnitProcessor class.

Thank you and regards,
Olaf

_______________________________________________
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

_______________________________________________
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

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


Back to the top