[hibernate-dev] how to get an EntityBinding by class name?

Steve Ebersole steve at hibernate.org
Fri Jul 6 10:31:45 EDT 2012


Ok, should have gone back to original question

Yes, you can name either Class name or entity-name, here.  In fact thats 
true of most of the Hibernate APIs.  Its a historical thing. Before 
Hibernate APIs were just like the JPA APIs in that you could only 
reference entities by Class reference.  With the development of the 
entity-name feature, thats no longer always possible.

We left the Class-reference forms available (non-deprecated) since if 
your application is not using entity-names that is still a valid way to 
reference the mappings/persisters because there is a one-to-one 
correspondence.  Otherwise, as already pointed out on this thread, you 
have a many-to-one correspondence (*a* single Class might reference 
multiple entity mappings).

On 07/06/2012 04:28 AM, Strong Liu wrote:
> Hi,
>
> having a question as $subject.
>
> the return element (org.hibernate.internal.jaxb.mapping.hbm.JaxbReturnElement) has both entity name and class name attributes, and we are supposed to use one of them to get the target EntityBinding.
>
> though look up entitybinding by entityname is easy, but I'm not sure how to look up entitybinding by class name, for now, i have used a stupid way, iterator the whole entitybindings within Metadata
>
> org.hibernate.metamodel.internal.source.annotations.global.SqlResultSetProcessor#bindEntityResult
>
> wondering if there is a better way to deal with this.
> -------------------------
> Best Regards,
>
> Strong Liu <stliu at hibernate.org>
> http://about.me/stliu/bio
>
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev



-- 
steve at hibernate.org
http://hibernate.org



More information about the hibernate-dev mailing list