Thanks for the hint. I solved the problem - as you suggested - by creating a new transaction when generate the key.
@TransactionAttribute( TransactionAttributeType.REQUIRES_NEW )
public Long findKeyAndSaveKey(){
}
That's ok because this method is called only once per session and further keys are generated using an algorithm.