I'm not aware of any bugs with inner aspects, how does it not work for you?

Andy


On 9 April 2013 08:52, Matthew Adams <matt...@matthewadams.me> wrote:

> I'd like to be able to create a POJO entity and declare an inner aspect.
>  For
> example:
>
> @Entity // introduced via ITD
> public class User {
>
>   @Id // introduced via ITD
>   Long id; // introduced via ITD
>
>   String username; // introduced via ITD
>
>   public static aspect Mapping {
>     declare @field: User.id: @GeneratedValue(GenerationType.SEQUENCE,
> generator="USER_SEQ");
>     declare @field: User.username: @Column(unique = true);
>   }
> }
>
> For those of you who'll inevitably ask "why would you do such a crazy
> thing?":  in the example above, class User is receiving the field "String
> username" via an introduction, and I want to add a JPA unique column
> constraint on the mapping.  This works fine if I declare aspect "Mapping"
> in
> its own file, but I'd like to keep each class's mapping with the class
> itself.
>
> For those of you who'll inevitably point me to ORM XML metadata:  I'm fully
> aware that I can do that; I just need to use the annotations for default
> mappings, overridden by XML if the user wants to override them.
>
> -matthew
>
>
>
> --
> View this message in context:
> http://aspectj.2085585.n4.nabble.com/Class-with-inner-aspect-tp4650850.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@eclipse.org
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to