Java ORM to read DB only

I know hibernate, but I'm wondering if there will be a lighter ORM engine for a read-only database . I mean, I don't need transactional queries or updates to some records. On the other hand, I need to process a large list of entries:

List<MyRecord> list= object.getMyRecords(); // list.size() > 1E7

Is there such an engine? Many thanks,

Pierre

+5
source share
7 answers

You can check out JIRM (yes, this is a shameless plugin) that is ORM oriented when using immutable objects.

It sits right above Spring JDBC, so if you use Spring, this is a very low risk to try.

SQL-, Spring.

, , jOOQ.

+2

ORM, OrmLite. ORM, Hibernate. , JPA, ORM .

OpenJPA, ORM, JPA, Apache . Hibernate. , , JPA (, Hibernate), .

Open Source, .

+1

Lite ORM . . , .

Hibernate , , . , .

, JDBC, , Active Record Table Gateway ..

ORM . - , .

+1

Ebeans, ORM:

  • JPA (@Entity, @OneToMany...) .
  • (.. API, JPA).
  • Value.
  • ORM

.

+1

, MyBatis (IBatis 3). . , , ORM.

+1

Spring SimpleJDBCTemplate , , -ORM- , .

0

ORM, jORM. , , .

, , ():

  • Hazzlefree
  • SQL

; .

DataSource dataSource = new DataSource();
dataSource.setDriverClassName("org.postgresql.Driver");
dataSource.setUrl("jdbc:postgresql://localhost:5432/moria");
dataSource.setUsername("gandalf");
dataSource.setPassword("mellon");

Database.configure("moria", dataSource); // now there a named database

@Jorm(database="moria", table="goblins", id="id")
public class Goblin extends Record {  
    public Integer getId() {
        return get("id", Integer.class);
    }
    public void setId(Integer id) {
        set("id", id);
    }
    public Integer getTribeId() {
        return get("tribe_id", Integer.class);
    }
    public void setTribeId(Integer id) {
        set("tribe_id", id);
    }
    public Tribe getTribe() {
        return get("tribe_id", Tribe.class);
    }
    public void setTribe(Tribe tribe) {
        set("tribe_id", tribe);
    }
    public String getName() {
        return get("name", String.class);
    }
    public void setName(String name) {
        set("name", name);
    }
}

Goblin goblin = Record.findById(Goblin.class 42);

List<Goblin> goblins = Record.findAll(Goblin.class);Goblin bolg = Record.find(Goblin.class, new Column("name", "Bolg"));

Tribe tribe = new Tribe();
tribe.setId(1);
String name = "Azog";

Goblin azog = Record.select(
    Goblin.class,
    "SELECT * FROM goblins WHERE name = #1# AND tribe_id = #2:id#",
    name, // #1#
    tribe // #2#
);

Goblin bolg = Record.find(Goblin.class, "SELECT * FROM goblins WHERE name = #1#", "Bolg");
0

All Articles