private void setDefaultSchema(HttpServletRequest request) { String hibernateDefaultSchemaTab = (String) request.getSession().getAttribute("xava_hibernateDefaultSchemaTab"); if (hibernateDefaultSchemaTab != null) { request.getSession().removeAttribute("xava_hibernateDefaultSchemaTab"); XHibernate.setDefaultSchema(hibernateDefaultSchemaTab); } String jpaDefaultSchemaTab = (String) request.getSession().getAttribute("xava_jpaDefaultSchemaTab"); if (jpaDefaultSchemaTab != null) { request.getSession().removeAttribute("xava_jpaDefaultSchemaTab"); XPersistence.setDefaultSchema(jpaDefaultSchemaTab); } }
public static void saveUpload(Reader csvFile, CSVStrategy strategy, ValueProcessorProvider vpp) { try { CSVReaderBuilder<Bank> builder = new CSVReaderBuilder<Bank>(csvFile); builder.strategy(strategy); CSVReader<Bank> csvReader = builder.entryParser(new AnnotationEntryParser<Bank>(Bank.class, vpp)).build(); List<Bank> banks = csvReader.readAll(); for (Bank bank : banks) { XPersistence.getManager().merge(bank); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }