[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-1551) @Embedded should use the field name as a prefix for the fields of the embedded objects.

Steve Ebersole (JIRA) noreply at atlassian.com
Mon Mar 21 13:00:39 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-1551.
-------------------------------


Closing stale resolved issues

> @Embedded should use the field name as a prefix for the fields of the embedded objects.
> ---------------------------------------------------------------------------------------
>
>                 Key: HHH-1551
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1551
>             Project: Hibernate Core
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 3.1.2
>            Reporter: Michael Newcomb
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> @Embeddable
> class Vector3f
> {
>   double getX()
>   double getY()
>   double getZ()
> }
> @Entity
> class Foo
> {
>   @Embedded
>   Vector3f getVelocity();
>   @Embedded
>   Vector3f getOrientation();
> }
> I get some errors from Hibernate about multiple columns in the Foo table. The only way it works is if I add @AttributeOverrides and specify unique columns for each embedded object.
> @Entity
> class Foo
> {
>   @Embedded
>   @AttributeOverrides(
>   {
>      @AttributeOverride(name="x", column=@Column(name="velocity_x")),
>      @AttributeOverride(name="x", column=@Column(name="velocity_y")),
>      @AttributeOverride(name="x", column=@Column(name="velocity_z"))
>   }
>   Vector3f getVelocity();
>   @Embedded
>   @AttributeOverrides(
>   {
>      @AttributeOverride(name="x", column=@Column(name="orientation_x")),
>      @AttributeOverride(name="x", column=@Column(name="orientation_y")),
>      @AttributeOverride(name="x", column=@Column(name="orientation_z"))
>   }
>   Vector3f getOrientation();
> }
> This is, IMHO, incredibly stupid. We are embedding the structure of the embedded class... WTF good is the embedded class? What happens when I want to add a member? Or change the names?
> Now, in older JBoss versions, the CMP container added the field name of the embedded class as a prefix to the fields in the embedded class. Much like the above:
> velocity_x
> velocity_y
> velocity_z
> orientation_x
> orientation_y
> orientation_z
> Thanks,
> Michael

-- 
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