Category: Database

Join the DZone community and get the full member experience. Imagine you start out your project, and your database model looks like the following.

Records you can no longer read, simply because your Data Access Layer (DAL) returns an instance of Customer as you query for customers, and your existing customers that are persisted as follows into your database ...

If you had used a relational database system, such as SQL Server, MySQL or MariaDB - And you combined it with for instance Entity Framework or (n)Hibernate, you'd at least get a compiler error as you updated your database model from your database, or vice versa.

For the record (pun!), there are ways to fix this, such as injecting some sort of adapter logic between the database reader, returning an untyped object, for then to "map" from the old structure to the new using code - But this only implies that you are aware of that there's an implicit schema in your database, and that you are willing to accommodate for it with code.

Related Articles