No announcement yet.
  • Filter
  • Time
Clear All
new posts

    smartgwt ee and datasources


    I am having trouble getting my hibernate beans to show up with the visual builder. I have deployed the showcase.war and replaced the hibernate.cfg.xml but have not copied my hbm files anywhere. Is there a simple tutorial on setting up the visual builder datasources?



    Here is some info on my environment. I am using Eclipse 3.5 and have the ds-hibernate sample working. I changed the on module load to launch the visual builder and it is working when launched from Eclipse.
    public void onModuleLoad() { ();

    Also, I have a small test class called DataTemp that adds and deletes a row in the Person tablesto show that Hibernate is set up correctly.

    Could you tell me where I need to put the cfg.xml, hbm.xml, and java files so that Visual Builder will pick them up? I have attached a screenshot of my project directory structure, the Entity is called Person.

    Attached Files


      Make sure that your modified hibernate.cfg.XML refers
      to the Person.hbm.xml mapping file. At that point, the Hibernate wizard in Visual Builder should show Person as an option. If not, please show your hibernate.cfg.xml and a screenshot of the Hibernate wizard running but not showing Person.




        So far no good, here is the screenshot of the Hibernate Bean gui attached. Below is my hibernate.cfg.xml which is in the src dir:
        <?xml version="1.0" encoding="utf-8"?>
        <!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
        <property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
        <property name="hibernate.connection.password">password</property>
        <property name="hibernate.connection.url">jdbc:postgresql://localhost/dhammareg</property>
        <property name="hibernate.connection.username">postgres</property>
        <property name="hibernate.current_session_context_class">thread</property>
        <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
        <property name="hibernate.show_sql">true</property>
        <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>

        <mapping resource="com/smartgwt/sample/server/Person.hbm.xml" />
        Attached Files


          no reply?


          I did not receive a reply to my last post - is there a tutorial for getting the visual builder working?


            There really aren't additional steps. Either something is wrong with that hibernate.cfg.xml, or it's not the one in use in the application where you are running Visual Builder.


              Where is your hibernate.cfg.xml file deployed? By default is it picked up from WEB-INF/classes/hibernate.cfg.xml. If its in a different location you can specify it in your as follows.

              hibernate.config: $webRoot/WEB-INF/classes/hibernate.cfg.xml

              The shipped ds-hibernate sample was programatically adding the SupplyItem class mapping to the hiberante configuration but in order for the Hibernate DS wiward to pick up the beans the mapping files need to be explicitly specified in the hibernate configuration file - which is how hibernate is typically configured anyway. I added

              <mapping resource="com/smartgwt/sample/server/SupplyItem.hbm.xml"/>

              to hibernate.cfg.xml in the hibernate-ds ds sample and used the Hibernate DS wizard it it was correctly picked up. See attached screenshot.
              Attached Files
              Last edited by; 27 Sep 2009, 11:03.


                The way I handled this (in NetBeans) was to create a project with my Hibernate stuff in it, all the XML and POJOs in the typical places.

                I added this to my .gwt.xml file:

                <inherits name=""/>
                and then I created a button to launch Visual Builder from my GWT app:

                     IButton vbButton = new IButton("VisualBuilder");
                     vbButton.addClickHandler(new ClickHandler() {
                         public void onClick(ClickEvent event) {
                All the beans showed up without a problem.

                Obviously I need to remove that for production but it seemed a lot easier for development not to be trying to move/copy my hibernate stuff around...