简体   繁体   中英

Questions about POJO!

i am converting my .net application to java. my DAL(Data Access Layer) is based on Linq2Sql.

will pojo provide me all the functinality which linq2sql provides ? i want to avoid hybernate because of performance issues i have heard from people who used it.

what i want from POJO is

1.load objects with childrens 2.query them using linq or some similary feature.

i am told that simple inserts , update and delete on entities are possible in POJO . plz confirm this.

thanks Jamal.

PS please answer all the qeustions having a question mark sign.

You have a single question mark sign.

The answer to that is no, POJO is just a Plain Old Java Object (Unless someone has made the terrible mistake of creating a library called POJO).

The closest you'll probably come to Linq2Sql is using Hibernate.

POJO (Plain Old Java Object) are simple objets to map variables usually are used to identify the entities.

For example if you have a table "Employee" with id and name. Your POJO can be like:

public class Employee {

   private Long id;

   private String name;

   public Long getId(){ return id;}
   public void setId(Long id){ this.id = id;}
   public String getName(){ return name;}
   public void setName(String name){ this.name = name;}
}

As you seen this object is only used to store the data associated to the Employee. The persistence is done by a ORM framework like Hibernate that can relate this pojo to a table in your database and provides methods to query the database for POJO objects like the Criteria API used by hibernate (that is little similar that the LINQ queries)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM