views:

88

answers:

2

I am making some small "business intelligence" applications/tools that need to talk to other systems. Primarily accounting systems that believe that databases are an integration layer (or are too lazy to provide an api).

What's the easiest way of getting specific data out of a third party database and into my Java objects?

Notes:

(I am now bolding the points below that have not been directly answered)

  1. This is absolutely a read only situation. I would prefer a solution that cannot write.
  2. Depending on speed and/or aggregation requirements, I may want/need to store these records at a future point. (This may or may not impact on solutions like hibernate which would have difficulty reading from one db and writing to another)
  3. The first cut would be a very select partial object population (I have generated my objects from an xml schema, and the database will only need to supply 30% of the possible fields etc)
  4. The first db integration target is (Visual?)FoxPro - hence point 2.
  5. I am currently developing primarily in Java, but expect that to change to scala soonish (can LINQ help here?)
+2  A: 

The standard of mapping db schema to objects (and vice versa) is the Java Persistence API. There are several implementation like Hibernate and EclipseLink (and others). I can't tell for all of them, but hibernate an eclipse plugin called hibernate tools, which can generate Java classes from the schema. You can find instructions here

JPA has its own query language called JPQL, Hibernate supports an extended version of it called HQL. Both looks like SQL, applied to objects.

David Rabinowitz
+1  A: 

I suggest you take a look at ScalaQuery, if you are doing Scala code.

Daniel