1. What is persistence
- Persistency is simply called as saving/storing data.
- Persistency is a term indicates permanent storage.
- Almost all applications require persistent data.
- Persistence is one of the fundamental concepts in application development.
- When we talk about persistence in Java, we’re normally talking about storing data in a relational database using SQL.
2. Types of persistent
- In java, we can save data in so many ways
- Files Systems → Store data in Files by using java.io
- XML file using → By using JAXP
- Database via sql → Store data in database by using JDBC api
- Database via java objects → Store data in database by using ORM
3. Disadvantages of File Persistency
- Writing and reading operations are complex, because we need to write lot of java code.
- Files don’t have any common query language like SQL.
- Files can’t be used for storing large amount of data
- Files are very less secured.
- We can’t maintain relationship between data in file.
4. Disadvantages of XML File Persistency
- Using XML file is almost equal to normal files.
- Normal file stores data only, but XML file stores the data and also maintain relationship between data.
- For searching data in XML file must be loaded and parsed.
- So XML files are very slow compared to databases
- XML files also less secure.
Note : Only advantage with XML files are language independent.
5. Advantages of Database via JDBC db Persistency over File persistency
- Files are some disadvantages, so we are going to databases via JDBC.
- Databases are simple to work.
- We have common query language like SQL
- Data stored in the database is secured.
- Database can store large amount of data.
- We can maintain the relationship between data.
6. Disadvantages of Database persistency via JDBC
- If any changes on database side like adding column or deleting column, we need to change java code also.
- In real time applications, data will be store in the form java objects in java application, so for executing query we need to convert java object to text values.
- JDBC uses sql language, it is database dependent language.
- JDBC code contains lot of duplicate code.
- Connections management and transaction management are very difficult.
Note : In future we will learn advantages of database persistency via ORM .
No comments:
Post a Comment