-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate, Annotations, Java compiler an JVM
PostPosted: Fri Jun 20, 2014 3:06 pm 
Newbie

Joined: Fri Jun 20, 2014 9:08 am
Posts: 1
I would like to understand the reason why, in the compiled java file, there are so complete informations about the .java file (non-compiled) Hibernate's annotations.

For security reasons, my development team is concerned about what goes inside the .class file.
We have noticed that after compiling an entity class, the .class file generated contains all the information about the entity annotations from the original .java file.

Since hibernate has evolved, it was offered to the users to substitute the xml centralized file by annotations in the entity classes.

It may sound obvious for some that if an object have all the necessary information about its own mapping to a table, it is the guy that is responsible for handle that relationship.
But that understanding shouldn't be so obvious.

To make possible to users to annotate in class files is an strategy to facilitate the development process and not necessarily has to mirror the lower level implementation.

If the xml generates an central object (or a set of it) that deals with the relationship between the java objects and their related database tables, this approach doesn't need necessarilly to be changed because of the annotation advent. Maybe in the compilation or even in the execution time, the annotations provided by the entity classes could be used to compound that centralized object built by the xml.
So the centralized approach could be what is being used even when you choose to annotate a class.

The point I would like to make clear is why that information is in the compiled (.class) file.
Is it because each entity has to handle is own mapping or is it for some other reason? Can the file be compiled withou the annotation information?
if so, the code will still work?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.