Doorgaan naar hoofdcontent

Posts

Posts uit augustus, 2016 tonen

JPA and transactions

So I was working with JPA and transactions. Consider the following: In bean 1, with implicit TX 1, managed entities are loaded/created,and returned in bean 2, with implicit TX 2, entities are modified in bean 3, with NO TX, bean 1 is called, and the results are passed to bean 2. and bean 4 is similar to bean 3, but with it's own transaction, TX3 What happens when bean 3 finishes: are the entities updated? What happens when bean 4 finishes, are the entities updated? The answer to this is simple; entities are managed through a persistance context. That context is tied to the transaction. So in bean 2, there is a difference. When called from bean 3, it runs in a different transaction then bean 1, and thus a different persistance context, and thus the entities are not managed 'by this transaction'.When called from bean 4, it all runs in the same transaction, TX3, and the results are persisted.

Minify javascript, etc.

Well, I've always felt that minify was useless if you had gzip on. Turns out, I'm not the only one saying that, and people have put their money where their mouth is. So there's actually quite a bit of reserach on it. http://stackoverflow.com/questions/807119/gzip-versus-minify https://css-tricks.com/the-difference-between-minification-and-gzipping/ Long story short: gzip is better then minify. gzip AND minify is even better. advantages of minify are that it can create a big ball of javascript, requiring only one GET reqeust

Articles Flash: Fail-Fast / Robustness, Rich/Anemic domain models

Some articles regarding design philosophies: Domain models: rich or anemic? World is at fire, both have advantages, disadvantages. Personally, I'm more of a data-driven anemic model. Where business logic is governed by the business layer, and persistance by the persistance layer, the question is where the domain model resides. I like it more in the persistance layer. This does allow one to hopelessly mutilate the domain model in not allowed ways, but it also SOLID, since it only has one responsibility. http://techblog.bozho.net/on-domain-driven-design-anemic-domain-models-code-generation-dependency-injection-and-more/ https://blog.inf.ed.ac.uk/sapm/2014/02/04/the-anaemic-domain-model-is-no-anti-pattern-its-a-solid-design/ http://stackoverflow.com/questions/23314330/rich-vs-anemic-domain-model And of course wikipedia: https://en.wikipedia.org/wiki/Anemic_domain_model For me, this is also because I'm not much of an OO-fan. Luckily, I'm not the only one: http://www...

Test email addresses

We've been there before. enter an emailaddress, get a verification in it. And in test it also sends those mails (and not to some fake location). https://www.mailinator.com accepts all mails, and stores them for a while. So send an email to spamthis@mailinator.com, go to the website, access the mailbox, and voila.