Hi Steve Moyer.

thinks a lot

i did this code i am putting here please abusarve this code and tell me
where i am did mistake

please help me out asap.


1) Persistence,xml.

<persistence-unit name="some_name_you_choose">
        <description>
            Persistence unit for the Envers tutorial of the Hibernate
Getting Started Guide
        </description>

        <class>com.webreg.server.NameData</class>

        <properties>
            <property name="javax.persistence.jdbc.driver"
value="com.mysql.jdbc.Driver" />
            <property name="javax.persistence.jdbc.url"
value="jdbc:mysql://localhost:3306/ccmdb" />
            <property name="javax.persistence.jdbc.user" value="root" />
            <property name="javax.persistence.jdbc.password" value="root" />

            <property name="hibernate.show_sql" value="true" />
            <!-- <property name="hibernate.hbm2ddl.auto" value="create" />
-->
        </properties>

    </persistence-unit>


2) server side code:
pakage name: com.server.dmain.

NameData.java.

@Entity
@Table(name = "NAME")
public class NameData {

public static final EntityManager entityManager() {
return EMF.get().createEntityManager();
}

public NameData persist() {
 try {
EntityManager em =entityManager();
em.persist(this);
}catch(Exception e){
System.out.println("exe:"+e);
}
//setter and getter's
.........
}

3) server side code
EMF.java

public final class EMF {
    private static final EntityManagerFactory emfInstance =
Persistence.createEntityManagerFactory(" some_name_you_choose");

    public static EntityManagerFactory get() {
        return emfInstance;
    }
    private EMF() {
      // nothing

    }
}


Thanks & Regards
laxman

On Wed, May 2, 2012 at 6:50 PM, Steve Moyer <smoye...@gmail.com> wrote:

> Can you include the code for the class this is in?  You can't do this
> in client code, and in server code, you'll need to make sure your
> persistence.xml file is found (my most common mistake).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-toolkit+unsubscr...@googlegroups.com.
> 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 google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to