How do I enable EJB 3.0 persistence annotation?

I hope I'm posting this at the correct place, as this has nothing to do with EAP.
I have a small project and an entity bean. I'm able to annotate it as @Entity and have the @Table annotation come up. It recognize the "name" property of the @Table annotation. However, when I try to assign a string value to the name property, it complains that it cannot resolve symbol.

@Entity
@Table(name = "mytable")
public class MyObject
...
...
...

I tried Java module as well as EJB module. It may very well be that the problem is not IntelliJ but "me". I'm new to annotations, though I can't see what I'm missing.
As a result of this, I can't use annotations to specify a table/column name.

5 comments
Comment actions Permalink

I was able to make it work though I don't know why. It seems I have to surround the values with parenthesis:

@Table(name = ("mytable"))

I'm working according to a book (Enterprise Java Beans) which doesn't have that.
There is also some source code you can download with it which compiles fine with any - weird!

I'm not familiar with JDK 5.0 and annotations and don't know if I'm missing something right under my nose.

0
Comment actions Permalink

Do you have a JPA facet? You will also need to create a datasource. Look under Tools, Data Sources. Then you will need to go back to the JPA facet and click in the area for the datasource (it does NOT have a click widget). Click it a few times and it will eventually pop open and your datasource will be below the blank line. Select it and you will be up and moving.

0
Comment actions Permalink

I was able to configure a datasource, as instructed.
After which I played with some options and was able to generate a class and make it compile.

Thanks for the help.

Though I'm still experimenting with it, my first impression that I don't like it much as this should be more of an option rather than a requirement, in the IDE.

0
Comment actions Permalink

I am not happy with it either. It should really lead me through what I need instead of relying on me "being in the know". If you create a JPA facet, you should be asked the information about the datasource (since it goes in the persistence.xml anyway).

The functionality is getting there, but there is still opportunities for improvement.

0
Comment actions Permalink

Another -1 for the JPA error checking, not very IDEA-developer friendly, like rest of IDEA.

0

Please sign in to leave a comment.