麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

更改osworkflow讓其支持hibernate3

2019-11-18 12:57:18
字體:
供稿:網(wǎng)友

  問題分析:
  
  OSWorkflow2.7.0支持 hibernate2.1.8
  
  問題一PRopertyset找不到對應(yīng)的源碼。在opensymphony上下載到的代碼與osworkflow中包含的propertyset包不一致。
  
  Osworkflow2.7.0自帶的為propertyset-1.3-21Apr04.jar。而實際在主站中下載到的為propertyset1.3.jar
  
  其中在propertyset-1.3-21Apr04.jar(沒有找到對應(yīng)的源碼)包中的
  
  DefaultHibernateConfigurationProvider包含成員變量和方法:
  
  Private net.sf.hibernate.cfg.Configuration configuration;
  
  Private com.opensymphony.module.propertyset.hibernate.HibernatePropertySetDAO propertySetDao;
  
  Private net.sf.hibernate.sessionFactory sessionFactory;
  
  Static synthetic java.lang.Class class$com$opensymphony$module$propertyset$hibernate$PropertySetItemImpl;
  
  方法:
  
  無參的構(gòu)造函數(shù)
  
  public void setConfiguration(Configuration configuration);
  
  public Configuration getConfiguration();
  
  public HibernatePropertySetDAO getPropertySetDAO();
  
  public void setSessionFactory(SessionFactory sessionFactory);
  
  public void setupConfiguration(Map configurationProperties);
  
  static synthetic Class class$(String x0);
  
  而在opensymphony上下載到的DefaultHibernateConfigurationProvider的代碼為:
  
  private Configuration configuration;
  
  private HibernatePropertySetDAO propertySetDAO;
  
  private SessionFactory sessionFactory;
  
  //~ Methods ////////////////////////////////////////////////////////////////
  
  public Configuration getConfiguration() {
  
  return configuration;
  
  }
  
  public HibernatePropertySetDAO getPropertySetDAO() {
  
  if (propertySetDAO == null) {
  
  propertySetDAO = new HibernatePropertySetDAOImpl(sessionFactory);
  
  }
  
  return propertySetDAO;
  
  }
  
  public void setupConfiguration(Map configurationProperties) {
  
  // loaded hibernate config
  
  try {
  
  configuration = new Configuration().addClass(PropertySetItem.class);
  
  Iterator itr = configurationProperties.keySet().iterator();
  
  while (itr.hasNext()) {
  
  String key = (String) itr.next();
  
  if (key.startsWith("hibernate")) {
  
  configuration.setProperty(key, (String) configurationProperties.get(key));
  
  }
  
  }
  
  this.sessionFactory = configuration.buildSessionFactory();
  
  } catch (HibernateException e) {
  
  }
  
  }
  
  另:
  
  類名與xml名的變化:
  
  PropertySetItem與PropertySetItem.hbm.xml
  
  在原有jar包中為PropertySetItemImpl和PropertySetItemImpl.hbm.xml
  
  解決辦法:
  
  問題二:hibernate包名的變化分析
  
  hibernate2中包含eXPression包,而在hibernate3中則沒有了。在hibernate3中多出來一個criterion包。
  
  Hibernate就在3.0的時候換上Antlr來解釋HQL,使HQL的語法獲得了加強。
  
  解決辦法:
  
  問題三:osworkflow所需要的必要的jar包,我在更改osworkflow源碼過程中,把webwork這部分去掉了,已解決,保證除了hibernate以外的其他部分可以正常便宜通過。盡量縮減需要更改的范圍。然后把原先的jar解壓,把更改的類重新覆蓋對應(yīng)的部分(只覆蓋更改的部分),然后重新打包即可。這部分已解決!通過從CVS上獲取最新代碼可以解決。
  
  代碼更改部分:
  
  propertyset更改方案:
  
  propertyset從CVS上獲取最新代碼,更改對應(yīng)hibernate包內(nèi)的所有引入的hibernate2改為hibernate3包。
  
  對于osworkflow從cvs上下載的代碼更改HibernateWorkflowStore
  
  添加兩個方法
  
  // add find method for this class by yunguang
  
  public List find(String queryString) throws StoreException {
  
  Query queryObject = session.createQuery(queryString);
  
  return queryObject.list();
  
  }
  
  public List find(String queryString, Object value) throws StoreException {
  
  Query queryObject = session.createQuery(queryString);
  
  queryObject.setParameter(0, value);
  
  return queryObject.list();
  
  }
  
  然后在此類中其他涉及到find方法的地方改到剛新加的find方法上,而hibernate2的find方法會多個type類型的參數(shù),去掉即可。
  
  包名更改好,其他就沒什么太大變動的地方,根據(jù)eclipse的錯誤提示一點一點改就可以了。
  
  問題解決備案:
  
  解決hibernate3的“System property org.xml.sax.driver not specified”異常錯誤。
  
  I got a SAXException("System property org.xml.sax.driver not specified")
  when I tried to run the SchemaExportTask.
  
  I solved the problem by installing jaxp. I then had to make sure that
  all the jars (dom.jar sax.jar xalan.jar xercesImpl.jar xsltc.jar)
  were in lib/endorsed under both my jdk installation root and my jre
  installation root.
  
  Hope that helps someone,
  Bobby
  
  so,in conclusion,in order to make it works as fine as you expected,you can do as the following ways to get an XMLReader:
  (1)
  XMLReader parser=XMLReaderFactory.createXMLReader(String className);
  (2)
  System.setProperty("org.xml.sax.driver","org.apache.xerces.parsers.SAXParser");
  XMLReader parser=XMLReaderFactory.createXMLReader();
  (3)
  System.setProperty("org.xml.sax.parser","org.apache.xerces.parsers.SAXParser");
  XMLReader parser=XMLReaderFactory.createXMLReader();
  (4) more directly
  XMLReader parser=new org.apache.xerces.parsers.SAXParser();
  
  note that:
  1) in case (3),the parser is an instance of ParserAdaptor,it doesn't support the feture "http://xml.org/sax/features/validation",differented from the other cases.
  2) in case (2),the class you specified should implement the interface XMLReader, in case (3),the class you specified should implement the interface SAXParser.org.apache.xerces.parsers.SAXParser is applicable in both case.
  
  我是采用第二種辦法解決的。
  
  WARN [(ehcache.config.Configurator)] No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/tools/eclipse3.1/workspace/osworkflowfromcvs/lib/optional/ehcache.jar!/ehcache-failsafe.xml
  
  ERROR [(spi.hibernate.SpringHibernateFunctionalWorkflowTestCase)] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'osworkflowConfiguration' defined in class path resource [osworkflow-spring.xml]: Can't resolve reference to bean 'workflowStore' while setting property 'store'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'workflowStore' defined in class path resource [osworkflow-spring.xml]: Can't resolve reference to bean 'sessionFactory' while setting property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [osworkflow-spring.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: antlr/ANTLRException
  
  解決辦法將antlr的jar包加上就好了。
  
  解決hibernate2轉(zhuǎn)移到hibernate3的
  
  ERROR [(org.hibernate.LazyInitializationException)] could not initialize proxy - the owning Session was closed
  
  通過跟蹤代碼可以發(fā)現(xiàn),在創(chuàng)建sessionfactory是在org.springframework.orm.hibernate3.LocalSessionFactoryBean中的  protected SessionFactory newSessionFactory(Configuration config) throws HibernateException {
  
  return config.buildSessionFactory();
  
  }
  
  方法創(chuàng)建出來的。
  
  對于外界提供sessionfactor

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 亚洲日本欧美 | 18欧美性xxxx极品hd | 精品国产一二区 | 精国品产一区二区三区有限公司 | 亚洲视频在线视频 | 欧美人禽 | 黄色一级毛片免费看 | 色柚视频网站ww色 | 久久久久久久久成人 | 黄色欧美精品 | 天天鲁在线视频免费观看 | 午夜男人在线观看 | 99re66热这里只有精品8 | 亚洲最大中文字幕 | 9191色 | 真人一级毛片免费 | a免费视频 | 久久精品欧美视频 | 久久影院在线观看 | 日韩欧美色综合 | 欧美一级爱爱 | 九九精品在线观看 | 成人午夜视频在线观看 | 黄色大片大毛片 | 欧美日韩专区国产精品 | www久久综合 | 最新午夜综合福利视频 | 日本高清无遮挡 | 久草在线手机观看 | 91成人天堂久久成人 | 一级黄色免费观看 | 在线成人免费视频 | 成人福利视频导航 | 欧美成人免费电影 | 91色爱| 久久精品视频一区二区三区 | 久久久精品综合 | 综合网日日天干夜夜久久 | 欧美一级毛片美99毛片 | 羞羞视频免费网站男男 | 男女隐私免费视频 |