private static void updateTexture(Session session) { SQLQuery sqlQuery = session.createSQLQuery( "select ID," + "GROUP_IDENTIFIER," + "CODE," + "SURFACE," + "ROTATABLE," + "NAME_RUS," + "PRICED_TYPE," + "MANUFACTURER_ID" + " from TEXTURE"); List list = sqlQuery.list(); for (Object o : list) { BigInteger ID = (BigInteger) ((Object[]) o)[0]; String GROUP_IDENTIFIER = (String) ((Object[]) o)[1]; String CODE = (String) ((Object[]) o)[2]; String SURFACE = (String) ((Object[]) o)[3]; Boolean ROTATABLE = (Boolean) ((Object[]) o)[4]; String NAME_RUS = (String) ((Object[]) o)[5]; String PRICED_TYPE = (String) ((Object[]) o)[6]; BigInteger MANUFACTURER_ID = (BigInteger) ((Object[]) o)[7]; sqlQuery = session.createSQLQuery( "INSERT INTO FURNITURE_CODE (" + "ID,GROUP_IDENTIFIER,CODE,SURFACE,ROTATABLE,NAME,PRICED_TYPE,MANUFACTURER_ID)" + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)"); sqlQuery.setBigInteger(0, ID); sqlQuery.setString(1, GROUP_IDENTIFIER); sqlQuery.setString(2, CODE); sqlQuery.setString(3, SURFACE); sqlQuery.setBoolean(4, ROTATABLE); sqlQuery.setString(5, NAME_RUS); sqlQuery.setString(6, PRICED_TYPE); sqlQuery.setBigInteger(7, MANUFACTURER_ID); sqlQuery.executeUpdate(); } }
private static void updateBORDER(Session session) { SQLQuery sqlQuery = session.createSQLQuery( "select ID," + "AMOUNT," + "LENGTH," + "BORDER_DEF_ID," + "TEXTURE_ID," + "ORDER_ID," + "PROVIDER_ID," + "DELIVERY_ID," + "CREATEDBY_ORDER_ID," + "STATUS," + "PRICE," + "ORDERED" + " from BORDER"); List list = sqlQuery.list(); for (Object o : list) { BigInteger ID = (BigInteger) ((Object[]) o)[0]; BigInteger AMOUNT = (BigInteger) ((Object[]) o)[1]; Double LENGTH = (Double) ((Object[]) o)[2]; BigInteger BORDER_DEF_ID = (BigInteger) ((Object[]) o)[3]; BigInteger TEXTURE_ID = (BigInteger) ((Object[]) o)[4]; BigInteger ORDER_ID = (BigInteger) ((Object[]) o)[5]; BigInteger PROVIDER_ID = (BigInteger) ((Object[]) o)[6]; BigInteger DELIVERY_ID = (BigInteger) ((Object[]) o)[7]; BigInteger CREATEDBY_ORDER_ID = (BigInteger) ((Object[]) o)[8]; String STATUS = (String) ((Object[]) o)[9]; Double PRICE = (Double) ((Object[]) o)[10]; String DISCRIMINATOR = "Border"; Boolean ORDERED = (Boolean) ((Object[]) o)[11]; sqlQuery = session.createSQLQuery( "INSERT INTO FURNITURE (" + "ID," + "AMOUNT," + "LENGTH," + "FURNITURE_TYPE_ID," + "FURNITURE_CODE_ID," + "ORDER_ID," + "PROVIDER_ID," + "DELIVERY_ID," + "CREATEDBY_ORDER_ID," + "STATUS," + "PRICE," + "DISCRIMINATOR," + "ORDERED" + ")" + " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"); sqlQuery.setBigInteger(0, ID); sqlQuery.setBigInteger(1, AMOUNT); sqlQuery.setDouble(2, LENGTH); sqlQuery.setBigInteger(3, BORDER_DEF_ID); sqlQuery.setBigInteger(4, TEXTURE_ID); sqlQuery.setBigInteger(5, ORDER_ID); sqlQuery.setBigInteger(6, PROVIDER_ID); sqlQuery.setBigInteger(7, DELIVERY_ID); sqlQuery.setBigInteger(8, CREATEDBY_ORDER_ID); sqlQuery.setString(9, STATUS); sqlQuery.setDouble(10, PRICE); sqlQuery.setString(11, DISCRIMINATOR); sqlQuery.setBoolean(12, ORDERED != null ? ORDERED : Boolean.FALSE); sqlQuery.executeUpdate(); } }