1 Reply Latest reply on Mar 8, 2008 4:20 PM by Jeremy Flowers

    ClassCastException: EJB3 CMP using EJB QL. Client using Stat

    Jeremy Flowers Newbie

      Hi folks.
      I've got a weird ClassCastException occurring in my code
      Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long...
      It happens with an event listener for stateChanged on a JCheckbox
      It calls into a method defined with ab int via an interface.
      Can't figure out why this is doing this as I think its some sort of error in a generated proxy.
      Can someone shed some light for me:
      Here is code:

      package client;
      
      import beans.StockList;
      import javax.naming.InitialContext;
      
      // general imports
      import java.awt.*;
      import java.awt.event.*;
      import java.util.*;
      import javax.swing.*;
      import javax.swing.event.*;
      
      public class StockClient extends JFrame
       implements ActionListener, ChangeListener {
       private StockList _stockList;
       private String _ticker;
       private JPanel _stockPanel = new JPanel();
       private JCheckBox _threeOnly =
       new JCheckBox("3 Letter Tickers Only");
      
       public StockClient() {
       // get the stock lister
       _stockList = getStockList();
      
       // add the title
       JLabel title = new JLabel("Stock List");
       title.setHorizontalAlignment(JLabel.CENTER);
       getContentPane().add(title, BorderLayout.NORTH);
      
       try {
       // add the stock list
       String[] stocks = _stockList.getAllStocks();
       populateStockPanel(stocks);
       JScrollPane scroller = new JScrollPane(_stockPanel);
       getContentPane().add(scroller, BorderLayout.CENTER);
       }
       catch (Exception e) {
       e.printStackTrace();
       }
      
       // add the buttons panel
       JPanel buttons = new JPanel(new GridLayout(1, 2));
       JButton get = new JButton("Get");
       get.addActionListener(this);
       buttons.add(get);
       buttons.add(_threeOnly);
       _threeOnly.addChangeListener(this);
       getContentPane().add(buttons, BorderLayout.SOUTH);
      
       addWindowListener(new WindowAdapter() {
       public void windowClosing(WindowEvent e) {
       System.exit(0);
       }
       });
      
       setSize(330, 150);
       setVisible(true);
       }
      
       private StockList getStockList() {
       StockList stockList = null;
       try {
       // Get a naming context
       InitialContext ctx = new InitialContext();
      
       // Get a StockList object
       stockList =
       (StockList) ctx.lookup("StockListBean/remote");
       } catch(Exception e) {
       e.printStackTrace();
       }
       return stockList;
       }
      
       public void actionPerformed(ActionEvent ae) {
       if (ae.getSource() instanceof JRadioButton) {
       JRadioButton rdo = (JRadioButton) ae.getSource();
       _ticker = rdo.getText();
       }
      
       // if get was clicked, get the stock
       if (ae.getSource() instanceof JButton) {
       if (_ticker == null || _ticker.length() == 0) {
       JOptionPane.showMessageDialog(this, "Select a stock!");
       return;
       }
      
       // get the stock
       try {
       String stockName = _stockList.getStock(_ticker);
       String msg = _ticker + " - " + stockName;
       JOptionPane.showMessageDialog(this, msg);
       }
       catch (Exception e) {
       e.printStackTrace();
       }
       }
       }
      
       public void stateChanged(ChangeEvent ce) {
       try {
       if (_threeOnly.isSelected()) {
       String[] stocks = _stockList.getSizeStocks(3);
       populateStockPanel(stocks);
       } else {
       String[] stocks = _stockList.getAllStocks();
       populateStockPanel(stocks);
       }
       }
       catch (Exception e) {
       e.printStackTrace();
       }
       }
      
       private void populateStockPanel(String[] stocks) {
       _stockPanel.removeAll();
       _stockPanel.setLayout(new GridLayout(stocks.length, 1));
      
       ButtonGroup bg = new ButtonGroup();
       for (int i = 0; i < stocks.length; i++) {
       JRadioButton stockButton = new JRadioButton(stocks);
       bg.add(stockButton);
       stockButton.addActionListener(this);
       _stockPanel.add(stockButton);
       }
       _stockPanel.invalidate();
       _stockPanel.validate();
       }
      
       public static void main(String[] args) {
       StockClient stockClient = new StockClient();
       }
       }
      


      package beans;
      
      import javax.persistence.Entity;
      import java.io.Serializable;
      import javax.persistence.Id;
      
      @Entity
      public class Stock implements Serializable {
       // The persistent fields
       private String tickerSymbol;
       private String name;
      
       // Constructors
       public Stock() {}
       public Stock(String tickerSymbol, String name) {
       this.tickerSymbol = tickerSymbol;
       this.name = name;
       }
      
       // The access methods for persistent fields
       // tickerSymbol is the id
       @Id
       public String getTickerSymbol() {
       return tickerSymbol;
       }
      
       public void setTickerSymbol(String tickerSymbol) {
       this.tickerSymbol = tickerSymbol;
       }
      
       public String getName() {
       return name;
       }
      
       public void setName(String name) {
       this.name = name;
       }
      }
      
      


      package beans;
      
      public class StockException extends Exception {
       public StockException() {
       super();
       }
      
       public StockException(String msg) {
       super(msg);
       }
      }
      


      package beans;
      
      import javax.ejb.Remote;
      
      @Remote
      public interface StockList {
       // The public business methods on the StockList bean
       public void addStock(String ticker, String name)
       throws StockException;
       public void updateStock(String ticker, String name)
       throws StockException;
       public void deleteStock(String ticker)
       throws StockException;
       public String getStock(String ticker)
       throws StockException;
       public String[] getAllStocks();
       public String[] getSizeStocks(int siz);
      }
      


      package beans;
      
      import beans.Stock;
      import javax.persistence.PersistenceContext;
      import javax.ejb.Stateless;
      import javax.persistence.EntityManager;
      import javax.persistence.Query;
      import java.util.*;
      
      @Stateless
      public class StockListBean implements StockList {
      
       // The reference to the entity manager
       @PersistenceContext(unitName="stkcmp")
       private EntityManager _manager;
      
       // The public business methods. These must be coded in the
       // interface also
      
       public String getStock(String ticker) throws StockException {
       Stock stock = _manager.find(Stock.class, ticker);
       if (stock == null) {
       throw new StockException();
       }
       return stock.getName();
       }
      
       public void addStock(String ticker, String name) throws StockException {
       Stock stock = _manager.find(Stock.class, ticker);
       if (stock != null) {
       throw new StockException();
       }
       _manager.persist(new Stock(ticker, name));
       }
      
       public void updateStock(String ticker, String name) throws StockException {
       Stock stock = _manager.find(Stock.class, ticker);
       if (stock == null) {
       throw new StockException();
       }
       stock.setName(name);
       }
      
       public void deleteStock(String ticker) throws StockException {
       Stock stock = _manager.find(Stock.class, ticker);
       if (stock == null) {
       throw new StockException();
       }
       _manager.remove(stock);
       }
      
       // The finder methods
       public String[] getAllStocks() {
       Query query =
       _manager.createQuery("SELECT s FROM Stock s " +
       "ORDER BY s.tickerSymbol");
       List stockList = query.getResultList();
       String[] stocks = new String[stockList.size()];
       int j = 0;
       for (int i = 0; i < stockList.size(); i++) {
       Stock stock = (Stock) stockList.get(i);
       stocks[j++] = stock.getTickerSymbol();
       }
       return stocks;
       }
      
       public String[] getSizeStocks(int siz) {
       Query query =
       _manager.createQuery("SELECT s FROM Stock s " +
       "WHERE LENGTH(s.tickerSymbol) = :len " +
       "ORDER BY s.tickerSymbol");
       query.setParameter("len", siz);
       List stockList = query.getResultList();
       String[] stocks = new String[stockList.size()];
       int j = 0;
       for (int i = 0; i < stockList.size(); i++) {
       Stock stock = (Stock) stockList.get(i);
       stocks[j++] = stock.getTickerSymbol();
       }
       return stocks;
       }
      }
      


      Here is some sample data to load up into HSQL Database

      insert into Stock values ('ABC', 'ABC Company');
      insert into Stock values ('ZZZ', 'Zigby Zebras');
      insert into Stock values ('ICS', 'Internet Corp of Slobovia');
      insert into Stock values ('DDC', 'Digby Door Company');
      insert into Stock values ('ZAP', 'Zapalopalorinski Ltd.');
      insert into Stock values ('JIM', 'Jimco');
      insert into Stock values ('SRU', 'Stocks R Us');
      insert into Stock values ('SRI', 'Shelves and Radios Inc');
      insert into Stock values ('FBC', 'Foo Bar Company');
      insert into Stock values ('DDBC', 'Ding Dong Bell Company');
      insert into Stock values ('UDE', 'Upn Down Elevator Company');

      Here is the error log that occurs:
      javax.ejb.EJBException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
       at org.hibernate.type.LongType.set(LongType.java:42)
       at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
       at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:116)
       at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:38)
       at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:491)
       at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1563)
       at org.hibernate.loader.Loader.doQuery(Loader.java:673)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
       at org.hibernate.loader.Loader.doList(Loader.java:2220)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
       at org.hibernate.loader.Loader.list(Loader.java:2099)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
       at beans.StockListBean.getSizeStocks(StockListBean.java:74)
       at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.getSizeStocks(Unknown Source)
       at client.StockClient.stateChanged(StockClient.java:103)
       at javax.swing.AbstractButton.fireStateChanged(AbstractButton.java:1889)
       at javax.swing.AbstractButton$Handler.stateChanged(AbstractButton.java:2310)
       at javax.swing.DefaultButtonModel.fireStateChanged(DefaultButtonModel.java:333)
       at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:252)
       at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:272)
       at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
       at java.awt.Component.processMouseEvent(Component.java:6041)
       at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
       at java.awt.Component.processEvent(Component.java:5806)
       at java.awt.Container.processEvent(Container.java:2058)
       at java.awt.Component.dispatchEventImpl(Component.java:4413)
       at java.awt.Container.dispatchEventImpl(Container.java:2116)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
       at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
       at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
       at java.awt.Container.dispatchEventImpl(Container.java:2102)
       at java.awt.Window.dispatchEventImpl(Window.java:2440)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
       at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
       at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.getSizeStocks(Unknown Source)
       at client.StockClient.stateChanged(StockClient.java:103)
       at javax.swing.AbstractButton.fireStateChanged(AbstractButton.java:1889)
       at javax.swing.AbstractButton$Handler.stateChanged(AbstractButton.java:2310)
       at javax.swing.DefaultButtonModel.fireStateChanged(DefaultButtonModel.java:333)
       at javax.swing.JToggleButton$ToggleButtonModel.setSelected(JToggleButton.java:252)
       at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:272)
       at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
       at java.awt.Component.processMouseEvent(Component.java:6041)
       at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
       at java.awt.Component.processEvent(Component.java:5806)
       at java.awt.Container.processEvent(Container.java:2058)
       at java.awt.Component.dispatchEventImpl(Component.java:4413)
       at java.awt.Container.dispatchEventImpl(Container.java:2116)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
       at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
       at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
       at java.awt.Container.dispatchEventImpl(Container.java:2102)
       at java.awt.Window.dispatchEventImpl(Window.java:2440)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
       at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
       at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
      javax.ejb.EJBException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
       at org.hibernate.type.LongType.set(LongType.java:42)
       at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
       at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:116)
       at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:38)
       at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:491)
       at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1563)
       at org.hibernate.loader.Loader.doQuery(Loader.java:673)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
       at org.hibernate.loader.Loader.doList(Loader.java:2220)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
       at org.hibernate.loader.Loader.list(Loader.java:2099)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
       at beans.StockListBean.getSizeStocks(StockListBean.java:74)
       at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.getSizeStocks(Unknown Source)
       at client.StockClient.stateChanged(StockClient.java:103)
       at javax.swing.AbstractButton.fireStateChanged(AbstractButton.java:1889)
       at javax.swing.AbstractButton$Handler.stateChanged(AbstractButton.java:2310)
       at javax.swing.DefaultButtonModel.fireStateChanged(DefaultButtonModel.java:333)
       at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:281)
       at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
       at java.awt.Component.processMouseEvent(Component.java:6041)
       at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
       at java.awt.Component.processEvent(Component.java:5806)
       at java.awt.Container.processEvent(Container.java:2058)
       at java.awt.Component.dispatchEventImpl(Component.java:4413)
       at java.awt.Container.dispatchEventImpl(Container.java:2116)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
       at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
       at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
       at java.awt.Container.dispatchEventImpl(Container.java:2102)
       at java.awt.Window.dispatchEventImpl(Window.java:2440)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
       at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
       at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.getSizeStocks(Unknown Source)
       at client.StockClient.stateChanged(StockClient.java:103)
       at javax.swing.AbstractButton.fireStateChanged(AbstractButton.java:1889)
       at javax.swing.AbstractButton$Handler.stateChanged(AbstractButton.java:2310)
       at javax.swing.DefaultButtonModel.fireStateChanged(DefaultButtonModel.java:333)
       at javax.swing.JToggleButton$ToggleButtonModel.setPressed(JToggleButton.java:281)
       at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
       at java.awt.Component.processMouseEvent(Component.java:6041)
       at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
       at java.awt.Component.processEvent(Component.java:5806)
       at java.awt.Container.processEvent(Container.java:2058)
       at java.awt.Component.dispatchEventImpl(Component.java:4413)
       at java.awt.Container.dispatchEventImpl(Container.java:2116)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
       at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
       at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
       at java.awt.Container.dispatchEventImpl(Container.java:2102)
       at java.awt.Window.dispatchEventImpl(Window.java:2440)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
       at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
       at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
      javax.ejb.EJBException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
       at org.hibernate.type.LongType.set(LongType.java:42)
       at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
       at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:116)
       at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:38)
       at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:491)
       at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1563)
       at org.hibernate.loader.Loader.doQuery(Loader.java:673)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
       at org.hibernate.loader.Loader.doList(Loader.java:2220)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
       at org.hibernate.loader.Loader.list(Loader.java:2099)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
       at beans.StockListBean.getSizeStocks(StockListBean.java:74)
       at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.getSizeStocks(Unknown Source)
       at client.StockClient.stateChanged(StockClient.java:103)
       at javax.swing.AbstractButton.fireStateChanged(AbstractButton.java:1889)
       at javax.swing.AbstractButton$Handler.stateChanged(AbstractButton.java:2310)
       at javax.swing.DefaultButtonModel.fireStateChanged(DefaultButtonModel.java:333)
       at javax.swing.DefaultButtonModel.setArmed(DefaultButtonModel.java:171)
       at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:237)
       at java.awt.Component.processMouseEvent(Component.java:6041)
       at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
       at java.awt.Component.processEvent(Component.java:5806)
       at java.awt.Container.processEvent(Container.java:2058)
       at java.awt.Component.dispatchEventImpl(Component.java:4413)
       at java.awt.Container.dispatchEventImpl(Container.java:2116)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
       at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
       at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
       at java.awt.Container.dispatchEventImpl(Container.java:2102)
       at java.awt.Window.dispatchEventImpl(Window.java:2440)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
       at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
       at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.getSizeStocks(Unknown Source)
       at client.StockClient.stateChanged(StockClient.java:103)
       at javax.swing.AbstractButton.fireStateChanged(AbstractButton.java:1889)
       at javax.swing.AbstractButton$Handler.stateChanged(AbstractButton.java:2310)
       at javax.swing.DefaultButtonModel.fireStateChanged(DefaultButtonModel.java:333)
       at javax.swing.DefaultButtonModel.setArmed(DefaultButtonModel.java:171)
       at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:237)
       at java.awt.Component.processMouseEvent(Component.java:6041)
       at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
       at java.awt.Component.processEvent(Component.java:5806)
       at java.awt.Container.processEvent(Container.java:2058)
       at java.awt.Component.dispatchEventImpl(Component.java:4413)
       at java.awt.Container.dispatchEventImpl(Container.java:2116)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
       at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
       at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
       at java.awt.Container.dispatchEventImpl(Container.java:2102)
       at java.awt.Window.dispatchEventImpl(Window.java:2440)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
       at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
       at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
      javax.ejb.EJBException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
      Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long
       at org.hibernate.type.LongType.set(LongType.java:42)
       at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:136)
       at org.hibernate.type.NullableType.nullSafeSet(NullableType.java:116)
       at org.hibernate.param.NamedParameterSpecification.bind(NamedParameterSpecification.java:38)
       at org.hibernate.loader.hql.QueryLoader.bindParameterValues(QueryLoader.java:491)
       at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1563)
       at org.hibernate.loader.Loader.doQuery(Loader.java:673)
       at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
       at org.hibernate.loader.Loader.doList(Loader.java:2220)
       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
       at org.hibernate.loader.Loader.list(Loader.java:2099)
       at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
       at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
       at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
       at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
       at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
       at beans.StockListBean.getSizeStocks(StockListBean.java:74)
       at sun.reflect.GeneratedMethodAccessor108.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
       at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
       at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
       at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
       at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
       at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
       at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
       at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
       at org.jboss.remoting.Client.invoke(Client.java:1634)
       at org.jboss.remoting.Client.invoke(Client.java:548)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.getSizeStocks(Unknown Source)
       at client.StockClient.stateChanged(StockClient.java:103)
       at javax.swing.AbstractButton.fireStateChanged(AbstractButton.java:1889)
       at javax.swing.AbstractButton$Handler.stateChanged(AbstractButton.java:2310)
       at javax.swing.DefaultButtonModel.fireStateChanged(DefaultButtonModel.java:333)
       at javax.swing.DefaultButtonModel.setRollover(DefaultButtonModel.java:266)
       at javax.swing.plaf.basic.BasicButtonListener.mouseExited(BasicButtonListener.java:255)
       at java.awt.Component.processMouseEvent(Component.java:6047)
       at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
       at java.awt.Component.processEvent(Component.java:5806)
       at java.awt.Container.processEvent(Container.java:2058)
       at java.awt.Component.dispatchEventImpl(Component.java:4413)
       at java.awt.Container.dispatchEventImpl(Container.java:2116)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
       at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4103)
       at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3968)
       at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
       at java.awt.Container.dispatchEventImpl(Container.java:2102)
       at java.awt.Window.dispatchEventImpl(Window.java:2440)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
       at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
       at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
       at $Proxy0.getSizeStocks(Unknown Source)
       at client.StockClient.stateChanged(StockClient.java:103)
       at javax.swing.AbstractButton.fireStateChanged(AbstractButton.java:1889)
       at javax.swing.AbstractButton$Handler.stateChanged(AbstractButton.java:2310)
       at javax.swing.DefaultButtonModel.fireStateChanged(DefaultButtonModel.java:333)
       at javax.swing.DefaultButtonModel.setRollover(DefaultButtonModel.java:266)
       at javax.swing.plaf.basic.BasicButtonListener.mouseExited(BasicButtonListener.java:255)
       at java.awt.Component.processMouseEvent(Component.java:6047)
       at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
       at java.awt.Component.processEvent(Component.java:5806)
       at java.awt.Container.processEvent(Container.java:2058)
       at java.awt.Component.dispatchEventImpl(Component.java:4413)
       at java.awt.Container.dispatchEventImpl(Container.java:2116)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
       at java.awt.LightweightDispatcher.trackMouseEnterExit(Container.java:4103)
       at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3968)
       at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
       at java.awt.Container.dispatchEventImpl(Container.java:2102)
       at java.awt.Window.dispatchEventImpl(Window.java:2440)
       at java.awt.Component.dispatchEvent(Component.java:4243)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
       at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
       at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
       at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)