Persism is a simple no-nonsense, auto-configuration, auto-discovery, convention over configuration Object Relational Mapping library. Persism uses POJOs for data objects and does not need any XML for configuration. Annotations are only used as a fall-back in cases where the library can't discover the mapping on it's own. Persism is pretty smart so you usually don't need to bother with annotations at all.

Persism has no external dependencies however it will use logging if available and it's only about 40k.

Persism has only 2 classes: Query for reading data and Command for updates/inserts and deletes.

// or a single objectPlayerfred = query.read(Player.class,"select * from PLAYERS where name = ?", "Fred");

// or even simplerPlayerfred = newPlayer();fred.setPlayerId(123); // set the primary keyquery.read(fred); // finds Fred in the database by primary key

Notice that the class is Player and the table is PLAYERS. Persism understands that and maps this for you without annotations. Heck, the library will also map things like Category -> CATEGORIES and PlayerAttributes - > [Player Attributes]. Plural table names and tables with spaces in the names would all map fine without annotating anything.

I've been using this library myself in various production applications. I marked it beta for now because I need some feedback on it before I finalize the API and also I added support for several different databases.

Simple. Persism doesn't directly support the idea of having hierarchical objects. It's up to you if want to do that. Persism uses SQL directly so you can do it yourself. The library doesn't impose the methodology.

There actually is no n+1 select "problem". It's a problem only in as much as most ORMs have query languages that can't really optimize the set oriented nature of relational databases. Persism uses SQL directly.

Cool that there is H2 support in there. If PostgreSQL can be added then it is pretty much solid for me I guess you have to deal with primary key generation yourself?

the pluralization mapping support reminds me a bit of Ruby On Rails' ActiveRecord.

Yeah I could test PostgreSQL. If you download it and try it - let me know how it goes. I'll add PostgreSQL to my list.

If you create a table like this:

1 2 3

CREATETABLEPLAYERS ( IDIDENTITY, NAMEVARCHAR(30) NULL ) -- etc...

Then you have a class

1 2 3 4 5 6

publicclassPlayer {

privateintid;privateStringname;// setters and getters}

You don't have to specify anything in the class. In most cases Persism detects that ID is autoinc (and therefore primary) even if you don't specify that it's a primary in the table create. The exception so far is Oracle which needs the annotation. I can dig into Oracle more deeply and see if I can prevent that in the future. The way Persism works is that it uses annotations only as a fall-back. You Normally don't need to specify anything special - simple POJOs are usually sufficient.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org