DEV Community

Guillaume Mary for Codefilarete

Posted on

3 3

Stalactite ORM 1.0.0 is out !

After many years of dev, Stalactite ORM is finally released ! It has a brand new approach about persistence :

  • mapping is defined by method references instead of Annotations or XML
  • its fluent API helps you see the complexity of you graph
  • it eagerly fetches your relations to avoid hidden sql queries

Here is a short view of what can be achieved with it :

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();
Enter fullscreen mode Exit fullscreen mode

Give it a try, see documentation here

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more