[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3155) Getter method metadata to support load()/getReference() proxies on field based id

Bob Tiernay (JIRA) noreply at atlassian.com
Wed Mar 5 19:52:35 EST 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3155?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29702 ] 

Bob Tiernay commented on HHH-3155:
----------------------------------

Well, it could if you wanted it to :)  But, I guess this would be overloading @Immutable's semantics.  I thought this was a good choice because: 

1. The annotation already exists
2. The issues at hand has to do with how getId() should not modify the state of the object (ie, the method should be immutable a la C++'s const keyword as it applies to methods.

What do you propose?

> Getter method metadata to support load()/getReference() proxies on field based id
> ---------------------------------------------------------------------------------
>
>                 Key: HHH-3155
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3155
>             Project: Hibernate3
>          Issue Type: Improvement
>            Reporter: Bob Tiernay
>
> Currently, the best reason to go with Property mapping in Hibernate performance: If you often loop through collections and only read the id of the entities Hibernate doesn't need to fetch the entities from the database if you use property access type. This is because Hibernate knows getId() only returns the id it already has, but Hibernate has no clue what your getId() method returns if you have marked @Id Long id; 
> Well, what I propose is giving Hibernate a clue, thus opening up the possibility that field based @Id can produce proxies. Perhaps all that is needed is something like this:
> @Id
> Long id;
> @Immutable
> Long getId(){return this.id};
> This way we can convey to Hibernate that getId() has no side effects.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list