Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - @Override
 - public boolean storeMe()
 - {
 - // No changes, nothing to store.
 - if (!hasChanges())
 - {
 - return false;
 - }
 - try (Connection con = DatabaseFactory.getConnection())
 - {
 - // Clear previous entries.
 - try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
 - {
 - st.setInt(1, _objectId);
 - st.execute();
 - }
 - // Insert all variables.
 - try (PreparedStatement st = con.prepareStatement(INSERT_QUERY))
 - {
 - st.setInt(1, _objectId);
 - for (Entry<String, Object> entry : getSet().entrySet())
 - {
 - st.setString(2, entry.getKey());
 - st.setString(3, String.valueOf(entry.getValue()));
 - st.addBatch();
 - }
 - st.executeBatch();
 - }
 - }
 - catch (SQLException e)
 - {
 - LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": Couldn't update variables for: " + getPlayer(), e);
 - return false;
 - }
 - finally
 - {
 - compareAndSetChanges(true, false);
 - }
 - return true;
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment