Home » Author Archives: Vlad Mihalcea (page 3)

Author Archives: Vlad Mihalcea

Vlad Mihalcea is a software architect passionate about software integration, high scalability and concurrency challenges.

MongoDB Incremental Migration Scripts

mongodb-logo

Introduction An incremental software development process requires an incremental database migration strategy. I remember working on an enterprise application where the hibernate.hbm2ddl.auto was the default data migration tool. Updating the production environment required intensive preparation and the migration scripts were only created on-the-spot. An unforeseen error could have led production data corruption. Incremental updates to the rescue The incremental database ...

Read More »

Integration testing done right with Embedded MongoDB

mongodb-logo

Introduction Unit testing requires isolating individual components from their dependencies. Dependencies are replaced with mocks, which simulate certain use cases. This way, we can validate the in-test component behavior across various external context scenarios. Web components can be unit tested using mock business logic services. Services can be tested against mock data access repositories. But the data access layer is ...

Read More »

Logical vs physical clock optimistic locking

software-development-2-logo

Introduction In my previous post I demonstrated why optimistic locking is the only viable solution for application-level transactions. Optimistic locking requires a version column that can be represented as: a physical clock (a timestamp value taken from the system clock) a logical clock (an incrementing numeric value) This article will demonstrate why logical clocks are better suited for optimistic locking ...

Read More »

The fastest way of drawing UML class diagrams

software-development-2-logo

A picture is worth a thousand words Understanding a software design proposal is so much easier once you can actually visualize it. While writing diagrams might take you an extra effort, the small time investment will pay off when others will require less time understanding your proposal. Software is a means, not a goal We are writing software to supports ...

Read More »

Preventing lost updates in long conversations

software-development-2-logo

Introduction All database statements are executed within the context of a physical transaction, even when we don’t explicitly declare transaction boundaries (BEGIN/COMMIT/ROLLBACK). Data integrity is enforced by the ACID properties of database transactions. Logical vs Physical transactions An logical transaction is an application-level unit of work that may span over multiple physical (database) transactions. Holding the database connection open throughout ...

Read More »

A beginner’s guide to database locking and the lost update phenomena

software-development-2-logo

Introduction A database is highly concurrent system. There’s always a chance of update conflicts, like when two concurring transactions try to update the same record. If there would be only one database transaction at any time then all operations would be executed sequentially. The challenge comes when multiple transactions try to update the same database rows as we still have ...

Read More »

Hibernate bytecode enhancement

jboss-hibernate-logo

Introduction Now that you know the basics of Hibernate dirty checking, we can dig into enhanced dirty checking mechanisms. While the default graph-traversal algorithm might be sufficient for most use-cases, there might be times when you need an optimized dirty checking algorithm and instrumentation is much more convinient than building your own custom strategy.         Using Ant ...

Read More »

How to customize Hibernate dirty checking mechanism

java-interview-questions-answers

Introduction In my previous article I described the Hibernate automatic dirty checking mechanism. While you should always prefer it, there might be times when you want to add your own custom dirtiness detection strategy. Custom dirty checking strategies Hibernate offers the following customization mechanisms:   Hibernate Interceptor#findDirty() CustomEntityDirtinessStrategy A manual dirty checking exercise As an exercise, I’ll build a manual ...

Read More »

The anatomy of Hibernate dirty checking

jboss-hibernate-logo

Introduction The persistence context enqueues entity state transitions that get translated to database statements upon flushing. For managed entities, Hibernate can auto-detect incoming changes and schedule SQL UPDATES on our behalf. This mechanism is called automatic dirty checking.           The default dirty checking strategy By default Hibernate checks all managed entity properties. Every time an entity ...

Read More »

The dark side of Hibernate AUTO flush

jboss-hibernate-logo

Introduction Now that I described the the basics of JPA and Hibernate flush strategies, I can continue unraveling the surprising behavior of Hibernate’s AUTO flush mode. Not all queries trigger a Session flush Many would assume that Hibernate always flushes the Session before any executing query. While this might have been a more intuitive approach, and probably closer to the ...

Read More »
Do you want to know how to develop your skillset and become a ...

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!
Get ready to Rock!
To download the books, please verify your email address by following the instructions found on the email we just sent you.

THANK YOU!

Close