-->
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.  [ 1 post ] 
Author Message
 Post subject: Cant store data in database table
PostPosted: Thu Dec 03, 2009 4:02 am 
Newbie

Joined: Thu Nov 26, 2009 2:54 am
Posts: 7
I created a table in database, i want to do view/add/edit/delete operations on that table. For that I created a jsp and showed the table data in a datatable JSF component.

Secondly, I have two input fields and a Save (submit) command button. This button calls a method saveLookupItem of LookupTable Bean. Here is the command button with two input fields.

Code:
<h:panelGrid border="0" columns="2">
                                                                        <h:inputText id="inputKey" value="#{LookupTable.lookupKey}"  />
                           <h:inputText id="inputValue" value="#{LookupTable.lookupValue}"  />
                           <h:commandButton value="Save" action="#{LookupTable.saveLookupItem}"/>
                        </h:panelGrid>


When command button is pressed, following method is called successfully.
Code:
public String saveLookupItem() {
      String status = "failure";
                ---- some code -----
      
      LookupTableDao lookupTableDao = (LookupTableDao) ServiceFinder
            .findBean("lookupTableDAOImpl");

           lookupTableDao.save(lookupTablePojo);
                ---- some code -----   
   }



This above method eventually calls the save method of A DAO lookupTableDao which is as follows

Code:
public void save(LookupTablePojo obj) {
      log.debug("saving LookupTableDao instance");
      try {
         getHibernateTemplate().save(obj);
         log.debug("save successful");
      } catch (RuntimeException re) {
         log.error("save failed", re);
         throw re;
      }
   }


This save method runs without any error but does not save any value. On the other hand methods that fetch data from db table like "findAll" and "findById" work fine. Please suggest what can I do to insert/save data.

JSF Managed bean

Code:
<managed-bean>
       <managed-bean-name>LookupTable</managed-bean-name>
       <managed-bean-class>com.lookuptables.web.ui.LookupTable</managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>   
    </managed-bean>


spring bean which is defined in application-context.xml

Code:
<bean id="lookupTableDAOImpl" class="com.lookuptables.dao.LookupTableDaoImpl">
      <property name="sessionFactory">
         <ref bean="sessionFactory"/>
      </property>
</bean>


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

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.