What is the difference between spring orm and spring dao




















Knowing this, now you can decide which one to use up. The good news is that you do not need to make a clear underlying technology for the final selection. This is where the thrust of Spring: As a developer, when you write code more focus on business logic, if you put a business deal, just some changes in the underlying technology implementations or configurations work detail.

Spring provides an API for transaction management. If your data access plan to use spring, then you should do transaction management with the spring, because they are really good together. For each data access technology supported by a spring, there is a transaction manager for the local affairs of the match, or if you need a distributed transaction you can also choose to JTA. They have achieved the same API, so persistence layer technology of choice but a matter of random adjustment configuration, change will not affect its business code.

Tech Community Register Log in. FaceBook Share. Gaetan explanation Each technical explanation of the above mentioned.

What scenarios should be used for each preference? In addition, spring now has another project Spring-data, is it a parent project of all the data access technologies provided by spring, or is it just a new name for Spring-dao? Gaetan's explanation of each of the above mentioned techniques. Spring-daospring-dao is not a Spring module, it is actually a specification that instructs you to write DAO operations and write good DAO operations.

Therefore, for accessing your data it neither provides an interface nor provides a template for implementation. For example, suppose you are using Hibernate, your service layer captureshibernateexceptionFor the relevant processing.

The level of exception provided by the underlying technology is often richer than that provided by Spring, and there is no qualification between the underlying technologies to match this. Such reliance is risky. But it's still a good idea to annotate your DAO class with Repository , as these beans are automatically added by the scanner. In addition, Spring may add other useful features to this annotation. It mainly defines two properties: a DataSource and a jdbctemplate, both of which can be used to implement the DAO method.

Jdbcdaosupport also provides an exception translator that converts SQL exceptions to Spring dataaccessexceptions. Spring-ormspring-orm is an umbrella module that includes many durable layer technologies jpa,jdo,hibernate,ibatis. For each of these technologies, Spring provides an integration class so that each technology can be used in accordance with spring's configuration principles and smoothly integrated with spring transaction management.

For each technique, the configuration is primarily to inject a DataSource bean into some kind ofsessionfactoryOrentitymanagerfactorysuch as beans. In a few other cases, you'll need to provide a query string in the comment for the lookup method. After the application context is loaded, spring provides the proxy for the DAO interface, which contains all boilerplate code related to data access technology and invokes the configured query.

The choice of which one understands these, now you can decide which to choose. Published at DZone with permission of Ramesh Fadatare. See the original article here. Thanks for visiting DZone today,. Edit Profile. Sign Out View Profile. Over 2 million developers have joined DZone. The two technologies are very similar, so what are the differences?

Like



0コメント

  • 1000 / 1000