- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Scala @BeanProperty with other annotations
Thu, 2009-04-02, 11:04
Hi all,
I'm just experimenting with Scala and Seam to try and get these two to work.
I'm looking for first class support for Java annotations in order to
take advantage of all of SEAM's offerings.
I have a simple RegisterAction (ported from the SEAM examples) and I
need to b e able to inject the PersistenceContext.
If I add a @BeanProperty to the attribute:
@PersistenceContext
@BeanProperty var em:EntityManager=_;
I get a getter and setter but still JBoss complains with:
@PersistenceUnit can only be used with a set method: public void
org.jboss.seam.example.registration.RegisterAction.em_$eq(javax.persistence.EntityManager)
If on the other hand I use
var em:EntityManager=_;
@PersistenceContext
def setEm(e:EntityManager)={ em=e; }
It works but is just too verbose...
Any ideas why the first approach doesn't work ?
Regards,
Nelson Silva
Nelson Silva schrieb:
> If I add a @BeanProperty to the attribute:
>
> @PersistenceContext @BeanProperty var em:EntityManager=_;
>
> I get a getter and setter but still JBoss complains [...]
>
> Any ideas why the first approach doesn't work ?
Because scalac doesn't put the annotations on the generated setters and
getters. It's just another case of the bug I filed today:
https://lampsvn.epfl.ch/trac/scala/ticket/1846
- Florian.