StalactiteのORM 1.0.0はアウトです!


多くの年のdevの後、Stalactite ORMは最終的にリリースされます!それは永続性についての新しいアプローチです
マッピングは、注釈またはXML の代わりにメソッドリファレンスによって定義されます
  • その流暢なAPIは、グラフ
  • の複雑さを見るのに役立ちます
  • それは熱心にSQLクエリを回避するためにあなたの関係を取得
  • ここでは何ができるかを簡単に説明します.
    DataSource dataSource = ... // use whatever JDBC DataSource you want
    PersistenceContext persistenceContext = new PersistenceContext(dataSource, new HSQLDBDialect());
    
    EntityPersister<Country, Long> countryPersister = MappingEase.entityBuilder(Country.class, long.class)
        .mapKey(Country::getId, IdentifierPolicy.afterInsert())
        .map(Country::getName)
        .map(Country::getDescription)
        .mapOneToOne(Country::getPresident, MappingEase.entityBuilder(Person.class, long.class)
            .mapKey(Person::getId, IdentifierPolicy.afterInsert())
            .map(Person::getName))
        .build(persistenceContext);
    
    Country country = new Country(42L);
    country.setPresident(new Person(12L));
    countryPersister.persist(country);
    
    // you can also map an SQL query to build a projection
    List<Car> allCars = persistenceContext.newQuery("select id, model, rgb from Car", Car.class)
        .mapKey(Car::new, "id", long.class)
        .map("model", Car::setModel)
        .map("rgb", Car::setColor, int.class, Color::new)
        .execute();
    
    試してみてください.