Thursday, April 23, 2015

Moving project to git repository

I have git repo at bitbucket


  1. create repository on bitbucket via web UI
  2. go to project directory folder on your machine
  3. git init
  4. git remote add origin "URL to repo"
  5. eclipse (with egit plugin) - share project using git
  6. commit & push

Ref:

Tuesday, April 7, 2015

SELECT FOR UPDATE

We have 2 machines with active active configuration and there is table with column for counters.
Db is on 3rd machine.
How to update these columns?


Example from code:

public InitialStateEntity findByIdWithLock(Long id)
{
DetachedCriteria criteria = DetachedCriteria.forClass(InitialStateEntity.class);
criteria.add(Restrictions.idEq(id));
criteria.setLockMode(LockMode.PESSIMISTIC_WRITE);
return (InitialStateEntity) criteria.getExecutableCriteria(getSession()).uniqueResult();
}



Ref:
https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/transactions.html