-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: newbie question - compiling POJO's w/ hibernate annotation
PostPosted: Wed Feb 23, 2005 5:37 pm 
Newbie

Joined: Wed Feb 23, 2005 5:11 pm
Posts: 3
I've downloaded hibernate3 beta 4 and hibernate annotations 3 alpha 2, and am trying to compile a very simple "hello world" example. With jdk 1.5 installed, i'm trying to compile a pojo:

package hello;

import javax.ejb.*;

@Stateless
@Remote
public class HelloWorldBean {
public String sayHello() {
return "Hello World!!!";
}
}

and a hibernate utility class:

package hello;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {

private static final SessionFactory sessionFactory;

static {
try {

AnnotationConfiguration configuration = new AnnotationConfiguration();
configuration.addPackage("hello");
configuration.addAnnotatedClass(HelloWorldBean.class);
sessionFactory = configuration.buildSessionFactory();
} catch (Throwable ex) {
// Log exception!
throw new ExceptionInInitializerError(ex);
}
}

public static Session getSession() throws HibernateException {
return sessionFactory.openSession();
}
}

I use the following command:

C:\temp\ejb3>c:\bin\dev\java\jdk_1.5\bin\apt -classpath lib\hibernate3.jar;lib\ejb-3.0-edr1.jar;lib\hibernate-annotations.jar;lib\jboss-j2ee.jar -sourcepath src src\hello\HibernateUtil.java src\hello\HelloWorldBean.java

and get the following results:

src\hello\HelloWorldBean.java:9: cannot find symbol
symbol: class Stateless
@Stateless
^
src\hello\HelloWorldBean.java:10: cannot find symbol
symbol: class Remote
@Remote
^
warning: No annotation processors found but annotations present.
1 warning
src\hello\HelloWorldBean.java:9: cannot find symbol
symbol: class Stateless
@Stateless
^
src\hello\HelloWorldBean.java:10: cannot find symbol
symbol: class Remote
@Remote
^
Note: src\hello\HibernateUtil.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

I read through the documentation on apt, and it seems that I need to specify an instance of AnnotationProcessorFactory. I grepped the hibernate and hibernate-annotations source trees, but found no references; is this a class I need to implement myself, or am I jumping the gun - that such an implementation will be included with hibernate, just not yet? I sincerely appreciate any help or feedback. Thanks,

-erath


Top
 Profile  
 
 Post subject: duplicate
PostPosted: Wed Feb 23, 2005 6:00 pm 
Newbie

Joined: Wed Feb 23, 2005 5:11 pm
Posts: 3
sorry - it seems this question was answered on feb 19 in the topic "Hibernate Annotations 3.0 alpha 2 & EJB3.0 EDR 2".


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.