hi folks,,
i have a problem with integration of gwt & hibernate,,,
when i use RPC without Hibernate & dataObj Movement over the network..it's work(for Object Like Inreger,String),,
but when i add the hibernate to the project & want to move a myOwn Class Object over the net to the server for Saving it to the DB,,it's make a error,,
this is my Error:
ERROR: Unable to find type 'com.mySampleApplication.client.MySampleApplication'
ERROR: Hint: Previous compiler errors may have made this type unavailable
ERROR: Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
ERROR: Failed to load module 'MySampleApplication' from user agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.71 Chrome/28.0.1500.71 Safari/537.36' at localhost:49745
this is Structure of My Project,,:
https://www.dropbox.com/s/tgcpz8luyivcgxt/gwt%2Bhibernate.png
this is my gwt Configuration File:
-- i have a problem with integration of gwt & hibernate,,,
when i use RPC without Hibernate & dataObj Movement over the network..it's work(for Object Like Inreger,String),,
but when i add the hibernate to the project & want to move a myOwn Class Object over the net to the server for Saving it to the DB,,it's make a error,,
this is my Error:
ERROR: Unable to find type 'com.mySampleApplication.client.MySampleApplication'
ERROR: Hint: Previous compiler errors may have made this type unavailable
ERROR: Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
ERROR: Failed to load module 'MySampleApplication' from user agent 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.71 Chrome/28.0.1500.71 Safari/537.36' at localhost:49745
this is Structure of My Project,,:
https://www.dropbox.com/s/tgcpz8luyivcgxt/gwt%2Bhibernate.png
this is my gwt Configuration File:
- <!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN"
- "http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd">
- <module rename-to="MySampleApplication">
- <!-- Inherit the core Web Toolkit stuff. -->
- <inherits name='com.google.gwt.user.User'/>
- <!-- Specify the app entry point class. -->
- <entry-point class='com.mySampleApplication.client.MySampleApplication'/>
- <source path="com.mySampleApplication.client"/>
- <!-- Specify the app servlets. -->
- <servlet path='/MySampleApplicationService' class='com.mySampleApplication.server.MySampleApplicationServiceImpl'/>
- </module>
I have Entity CLass With name Student :
- @Entity
- @Table(name="STUDENT")
- public class Student implements Serializable{
- @Id
- @GeneratedValue
- Integer id;
- @Column
- String name;
- @Column
- String family;
- //setter & getter
- //constructor with 2 Argument,,& no Argument
- }
i Have Student Manager:
- public class StudentManage{
- private static SessionFactory factory;
- public StudentManage()
- {
- try{
- factory = new AnnotationConfiguration().
- addAnnotatedClass(Student.class).
- configure("hibernate.cfg.gwt.xml").buildSessionFactory();
- }catch (Throwable ex) {
- System.err.println("Failed to create sessionFactory object." + ex);
- throw new ExceptionInInitializerError(ex);
- }
- }
- public void save(Student stu)throws Exception
- {
- Session session = factory.openSession();
- Transaction tx=session.beginTransaction();
- session.saveOrUpdate(stu);
- tx.commit();
- session.close();
- }
- }
this is implementation of My Service in the Server :
- public class MySampleApplicationServiceImpl extends RemoteServiceServlet implements MySampleApplicationService {
- @Override
- public String setStu(Student stu) {
- //System.out.println("In the set");
- StudentManage studentManage=new StudentManage();
- try {
- studentManage.save(stu);
- } catch (Exception e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- return "Data Saved in DB";
- }
- }
And this is my own Code for the Client Side to send the Object to the Server,,
- public void onModuleLoad() {
- button.addClickHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- System.out.println("int the ClickEvent");
- MySampleApplicationService.App.getInstance().setStu(stu, new AsyncCallback<String>() {
- @Override
- public void onFailure(Throwable caught) {
- Window.alert("Error");
- }
- @Override
- public void onSuccess(String result) {
- Window.alert("Data is in the DB..." + result);
- }
- });
- }
- });
- }
i'm wating for your Solutions,,
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment