You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "juergen.schumacher" <ju...@ir-team.com> on 2006/12/27 19:46:45 UTC

Annotation @Entity

Hi,
I tried to use the annotations inside my classes for hibernate like @Entity,
@Id, .... but the compiler during the maven build complains. Now I found a
maven hibernate plugin but here I still have to use the XML file instead of
annotations. Am I right that annotations not supported?

Have a nice day,
Juergen
-- 
View this message in context: http://www.nabble.com/Annotation-%40Entity-tf2887173s177.html#a8066007
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Annotation @Entity

Posted by Eric Redmond <er...@gmail.com>.
If you have the compiler set to 1.5, and you have the annotation class's
jars as dependencies, then I don't see why you would have a problem. Post
the exact error.

Eric

On 12/28/06, juergen.schumacher <ju...@ir-team.com> wrote:
>
>
> Hi,
> I dont know, do I have to use the jboss plugin if I work with Hibernate?
> As
> I said I would like to use hibernate and in one java class I used @Entity
> and @Id to specify the mapping. But the compiler complains. I have set the
> version to 1.5 already, then I found here in the forum some questions
> about
> hiobernate but always the other hibernate configuration way is used with
> xml
> files. Now I am wondering if there is any way to use the annotations in
> java
> files. Maybe is some special setting necessary?
>
> Here is an example:
> ....
>
> @Entity
> @Table(name="user")
> public class User implements Serializable{
>         @Id
>         @GeneratedValue(generator="uuid-gen")
>         @GenericGenerator(name="uuid-gen", strategy="uuid")
>         public String getUserid() { return this.userid;}
>
> ....
>
> Have a nice day,
> juergen
>
>
>
> Eric Redmond wrote:
> >
> > Annotations are supported, but you have to set the correct version. The
> > JBoss packaging plugin supports hibernate, but defaults to 2.1. If you
> set
> > the version to 3.0 it will work. I don't know what plugin you are using,
> > however, so I'd check the plugin's docs.
> >
> > Eric
> >
> > On 12/27/06, juergen.schumacher <ju...@ir-team.com> wrote:
> >>
> >>
> >> Hi,
> >> I tried to use the annotations inside my classes for hibernate like
> >> @Entity,
> >> @Id, .... but the compiler during the maven build complains. Now I
> found
> >> a
> >> maven hibernate plugin but here I still have to use the XML file
> instead
> >> of
> >> annotations. Am I right that annotations not supported?
> >>
> >> Have a nice day,
> >> Juergen
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Annotation-%40Entity-tf2887173s177.html#a8066007
> >> Sent from the Maven - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
> >
> > --
> > Eric Redmond
> > http://codehaus.org/~eredmond
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Annotation-%40Entity-tf2887173s177.html#a8082456
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Eric Redmond
http://codehaus.org/~eredmond

Re: Annotation @Entity

Posted by "juergen.schumacher" <ju...@ir-team.com>.
Hi,
I dont know, do I have to use the jboss plugin if I work with Hibernate? As
I said I would like to use hibernate and in one java class I used @Entity
and @Id to specify the mapping. But the compiler complains. I have set the
version to 1.5 already, then I found here in the forum some questions about
hiobernate but always the other hibernate configuration way is used with xml
files. Now I am wondering if there is any way to use the annotations in java
files. Maybe is some special setting necessary?

Here is an example:
....

@Entity
@Table(name="user")
public class User implements Serializable{
	@Id
	@GeneratedValue(generator="uuid-gen")
	@GenericGenerator(name="uuid-gen", strategy="uuid")
	public String getUserid() { return this.userid;}

....

Have a nice day,
juergen



Eric Redmond wrote:
> 
> Annotations are supported, but you have to set the correct version. The
> JBoss packaging plugin supports hibernate, but defaults to 2.1. If you set
> the version to 3.0 it will work. I don't know what plugin you are using,
> however, so I'd check the plugin's docs.
> 
> Eric
> 
> On 12/27/06, juergen.schumacher <ju...@ir-team.com> wrote:
>>
>>
>> Hi,
>> I tried to use the annotations inside my classes for hibernate like
>> @Entity,
>> @Id, .... but the compiler during the maven build complains. Now I found
>> a
>> maven hibernate plugin but here I still have to use the XML file instead
>> of
>> annotations. Am I right that annotations not supported?
>>
>> Have a nice day,
>> Juergen
>> --
>> View this message in context:
>> http://www.nabble.com/Annotation-%40Entity-tf2887173s177.html#a8066007
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 
> -- 
> Eric Redmond
> http://codehaus.org/~eredmond
> 
> 

-- 
View this message in context: http://www.nabble.com/Annotation-%40Entity-tf2887173s177.html#a8082456
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Annotation @Entity

Posted by Eric Redmond <er...@gmail.com>.
Annotations are supported, but you have to set the correct version. The
JBoss packaging plugin supports hibernate, but defaults to 2.1. If you set
the version to 3.0 it will work. I don't know what plugin you are using,
however, so I'd check the plugin's docs.

Eric

On 12/27/06, juergen.schumacher <ju...@ir-team.com> wrote:
>
>
> Hi,
> I tried to use the annotations inside my classes for hibernate like
> @Entity,
> @Id, .... but the compiler during the maven build complains. Now I found a
> maven hibernate plugin but here I still have to use the XML file instead
> of
> annotations. Am I right that annotations not supported?
>
> Have a nice day,
> Juergen
> --
> View this message in context:
> http://www.nabble.com/Annotation-%40Entity-tf2887173s177.html#a8066007
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Eric Redmond
http://codehaus.org/~eredmond