ERROR-org.hibernate.type.SerializationException:无法反序列化

时间:2018-07-15 15:37:06

标签: java

我是春季刚入睡的新人。     我有以下例外。 谁能帮忙。...

org.hibernate.type.SerializationException: could not deserialize
    at org.hibernate.internal.util.SerializationHelper.doDeserialize(SerializationHelper.java:262)
    at org.hibernate.internal.util.SerializationHelper.deserialize(SerializationHelper.java:306)
    at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.fromBytes(SerializableTypeDescriptor.java:155)
    at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:130)
    at org.hibernate.type.descriptor.java.SerializableTypeDescriptor.wrap(SerializableTypeDescriptor.java:44)
    at org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:71)
    at org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:267)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:263)
    at org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
    at org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:338)
    at org.hibernate.loader.Loader.extractKeysFromResultSet(Loader.java:785)
    at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:721)
    at org.hibernate.loader.Loader.processResultSet(Loader.java:953)
    at org.hibernate.loader.Loader.doQuery(Loader.java:921)
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:355)
    at org.hibernate.loader.Loader.doList(Loader.java:2554)
    at org.hibernate.loader.Loader.doList(Loader.java:2540)
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2370)
    at org.hibernate.loader.Loader.list(Loader.java:2365)
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:497)

这是模特班     DashModel.java

@Entity
@Table(name = "VIEW_GENERAL_SALES_DASHBOARD")
@DynamicUpdate(true)


public class DashModel implements Serializable  {

    private static final long serialVersionUID = -3465813074586302847L;

    public DashModel() {
        System.out.println("VIEW_GENSALES_DASH....");
    }

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column
    private Integer VIEW_ROW;       

    public Integer getVIEW_ROW() {
        return VIEW_ROW;
    }

    public void setVIEW_ROW(Integer vIEW_ROW) {
        VIEW_ROW = vIEW_ROW;
    }

    @Column
    private String VIEW_CLASS;


    @Column
    private String VIEW_ZONE;

    @Column
    private double VIEW_GWP;

    @Column
    private double VIEW_TARGET;

    @Column
    private double VIEW_VARIANCE;

    @Column
    private double VIEW_ACHIEVEMENT;

    public String getVIEW_CLASS() {
        return VIEW_CLASS;
    }

    public void setVIEW_CLASS(String vIEW_CLASS) {
        VIEW_CLASS = vIEW_CLASS;
    }

    public String getVIEW_ZONE() {
        return VIEW_ZONE;
    }

    public void setVIEW_ZONE(String vIEW_ZONE) {
        VIEW_ZONE = vIEW_ZONE;
    }

    public double getVIEW_GWP() {
        return VIEW_GWP;
    }

    public void setVIEW_GWP(double vIEW_GWP) {
        VIEW_GWP = vIEW_GWP;
    }

    public double getVIEW_TARGET() {
        return VIEW_TARGET;
    }

    public void setVIEW_TARGET(double vIEW_TARGET) {
        VIEW_TARGET = vIEW_TARGET;
    }

    public double getVIEW_VARIANCE() {
        return VIEW_VARIANCE;
    }

    public void setVIEW_VARIANCE(double vIEW_VARIANCE) {
        VIEW_VARIANCE = vIEW_VARIANCE;
    }

    public double getVIEW_ACHIEVEMENT() {
        return VIEW_ACHIEVEMENT;
    }

    public void setVIEW_ACHIEVEMENT(double vIEW_ACHIEVEMENT) {
        VIEW_ACHIEVEMENT = vIEW_ACHIEVEMENT;
    }

}

这是道课     DashDao.java

@Repository
public class DashDao {

     Connection con;
        Statement st;
        ResultSet rs;

    @Autowired
     private SessionFactory sessionFactory;

     public void setSessionFactory(SessionFactory sf) {
      this.sessionFactory = sf;
      System.out.println("setSessionFactory ()");
     }

     public DashDao() {
            System.out.println("Dash dao ()");
        }

     //this code is to load all the companies
     public List<DashModel> getAllCompany() {

         List<DashModel> companees = null;
         //Session session = sessionFactory.openSession();
         Session session = sessionFactory.getCurrentSession();
         org.hibernate.Transaction tx = null;

         try {

                System.out.println("connect ");


                    tx = session.beginTransaction();
                    companees= session.createQuery("from DashModel").list();

                     tx.commit();


                } catch (Exception e) {

                    System.out.println("Error ");
                    e.printStackTrace();
                    JOptionPane.showMessageDialog(null, e);
                    return null;
                } 

        return companees;
 }

}

这是服务DashService.java

@Service("dashservice")

public class DashService {

    @Autowired
    DashDao dashdao;

    public DashService() {
        System.out.println("Dash service()");
    }


    @Transactional
     public List<DashModel> getAllCompany(){

     return(dashdao.getAllCompany());

     }


}

这是我的控制器班     DashController.java

@Controller
public class DashController {

    @Autowired
    DashService dashservice;

    private static final Logger logger = Logger
            .getLogger(DashController.class);

    public DashController() {
        System.out.println("Dash Controller()");
    }


    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView listPersonsre(Model model, HttpSession session, HttpServletRequest request) {
        System.out.println("I am hear in / request");
        ModelAndView md = null;
        md= new ModelAndView("dashboard");
    return md;
    }

    // this code is to retrive all companys.
        @RequestMapping(value = "/companylist", method = RequestMethod.POST, produces = "application/json")
        public @ResponseBody List<DashModel> companyList(@ModelAttribute @Valid DashModel company, BindingResult result,
                ModelAndView model) {
            System.out.println("company List");
            List<DashModel> companyList = new ArrayList<DashModel>();

            return dashservice.getAllCompany();
        }



}

这是我的数据库视图

CREATE OR REPLACE VIEW VIEW_GENERAL_SALES_DASHBOARD ( VIEW_ROW, 
VIEW_CLASS, VIEW_ZONE, VIEW_GWP, VIEW_TARGET, 
VIEW_VARIANCE, VIEW_ACHIEVEMENT, VIEW_GROWTH )

此视图中没有主键。这就是为什么我向该视图创建ROWNUM的原因。 希望对您有所帮助和建议! 谢谢。...

0 个答案:

没有答案