hey Nenad,

I use hibernate 3.0 with GWT 2.0 without problem. comparing your exemple
with mine I don't use Hibernate Annotation I'm using xml configuration. I
did 2 Eclipse project. first is my business tier where i did hibernate
enginer and my persists classes. and second project is gtw project.

then i make a package of first project and save file.jar in
gwt-web-project\war\web-inf\lib

i just do access on hibernate engine in sever side.

it is working very well.

I hope it is can help you.

Regards
Bruno


On Mon, Feb 8, 2010 at 1:07 PM, John Ivens <[email protected]>wrote:

> Not sure I've seen all the mistakes, but shouldn't it be
> from User u where u.snarfle = blarg
>
> Looks like the class is correctly annotated.
> I use hbm files and in that case you need to tell hibernate which classes
> are mapped to which hbm files in the hibernate.cfg.xml file.
> You may need to do the equivalent when you annotate classes, but I am not
> sure how.
>
> On Sun, Feb 7, 2010 at 6:02 PM, Nenad <[email protected]> wrote:
>
>> Hi,
>> I am new in GWT and I like this concept, so I've tried to create GWT
>> application with hibernate support. I have a problem with Object
>> mapping.
>> This is my "persistence.properties" file (it is in src folder of my
>> project):
>> hibernate.connection.driver_class = com.mysql.jdbc.Driver
>> hibernate.connection.url = jdbc:mysql://localhost:3306/gwt_web_shop_db
>> hibernate.connection.username = root
>> hibernate.connection.password = somepass
>> hibernate.c3p0.min_size=5
>> hibernate.c3p0.max_size=20
>> hibernate.c3p0.timeout=1800
>> hibernate.c3p0.max_statements=50
>> hibernate.dialect = org.hibernate.dialect.MySQLDialect
>> hibernate.connection.pool_size = 4
>> hibernate.show_sql = true
>> hibernate.hbm2ddl.auto = create
>> hibernate.archive.autodetection = class
>>
>> When I run application (in Eclipse) everything goes ok with this code:
>> public UserServiceImpl(){
>>        EntityManagerFactory emf =
>> Persistence.createEntityManagerFactory("");
>>            em = emf.createEntityManager();
>> }
>> ,but when I try something like this:
>>
>> Query q = em.createQuery("select u from User where u.username
>> = :username");
>> q.setParameter("username", username);
>> List<User> res = q.getResultList();
>>
>> I get this Exception: java.lang.IllegalArgumentException:
>> org.hibernate.hql.ast.QuerySyntaxException: User is not mapped [select
>> u from User where u.username = :username]
>>
>> Here is my User.java class:
>>
>> package gwtWebshop.client.entities;
>>
>> import java.io.Serializable;
>>
>> import javax.persistence.Entity;
>> import javax.persistence.GeneratedValue;
>> import javax.persistence.GenerationType;
>> import javax.persistence.Id;
>> import javax.persistence.Table;
>>
>> @Entity(name="User")
>> @Table(name="users")
>> public class User implements Serializable{
>>        /**
>>         *
>>         */
>>        private static final long serialVersionUID = 1L;
>>        private int id;
>>        private String username;
>>        public User() {
>>        }
>>
>>        @Id
>>        @GeneratedValue(strategy = GenerationType.IDENTITY)
>>        public int getId() {
>>                return id;
>>        }
>>        public String getUsername() {
>>                return username;
>>        }
>>        public void setId(int id) {
>>                this.id = id;
>>        }
>>        public void setUsername(String username) {
>>                this.username = username;
>>        }
>> }
>>
>> I concluded that the mapping is not done automatically based on the
>> annotation, but I do not know how to change that.
>>
>> Please help me and tell me the right way to do this.
>> Thank you.
>>
>> Regards,
>> Nenad
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google Web Toolkit" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<google-web-toolkit%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/google-web-toolkit?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to