Hi everyone,

I am facing a problem retriveing the Maximum ID from a table called "Memo".

In ejb-jar.xml file I have defined the query in the following manner-

      
        <query-method>
          <method-name>findMaxID</method-name>
          <method-params/>
        </query-method>
        <ejb-ql><![CDATA[SELECT max(a.id) FROM Memo AS a]]></ejb-ql>
      

and in the LocalHome interface the method has been declared as below -
MemoLocal findMaxID ( ) throws FinderException;


But when I call this findMaxID() function from my session bean in the following -


public int findMaxIDInMemo()throws NamingException, FinderException
  {
                MemoLocalHome memoLocalHome;
                MemoLocal memoLocal;

                int iRetVal = 0;
    try 
    {
                         memoLocalHome = this.getMemoLocalHome();
                         memoLocal = memoLocalHome.findMaxID();
                         iRetVal  = Integer.parseInt(memoLocal.getId().toString()); 
                        RetVal ++;              
    } catch (Throwable e) 
    {
      e.printStackTrace();
    }

    return iRetVal;
  }
        
I get this error-

javax.ejb.FinderException: Find failed: java.sql.SQLException: Got a 
java.lang.Long[cl=0, value=1] 


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3852154#3852154

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3852154


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to