1

I've seen something to this effect in the past but I failed to find how I would do this so I will give pseudocode to demonstrate something I remember seeing this.

Table entries would be defined with a class, something to the following effect.

class Person {
    @ (an annotation that specified what SQL type to use for below field)
    String name;
    @ ...
    int age;
}

One would make SQL calls but the

Person[] persons = sqlconn.select("SELECT * FROM table_name", Person.class)

or something to this effect.

Not exactly prepare statements because these calls populate the objects.

1
  • i think you are looking for JPA and NativeQueries Commented Oct 29, 2012 at 17:04

1 Answer 1

3

Hibernate will do this for you, but it has a fairly steep learning curve.

There are other JPA implementations to consider, some of which are explored here.

A simple alternative is to use Spring's jdbcTemplate as detailed here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.