3 ms·
Hibernate is a fairly popular way of dealing with OR mapping in Java: https://www.hibernate.org/ https://www.hibernate.org/ Unfortunately, you'll end up tradi
by icey 17y ago
Hibernate is a fairly popular way of dealing with OR mapping in Java:
https://www.hibernate.org/ https://www.hibernate.org/
Unfortunately, you'll end up trading off code cleanliness with XML configuration files, but I believe there are tools out there that help with the generation and maintenance of those files.
I feel that I may have missed some of what you're looking for though, so if Hibernate is the wrong solution for you let me know and maybe I can help you get nearer to a workable solution.
- jacquesm 17y agoI found a way to use the 'reflect' class to figure out the mappings, and by caching them after the first query it is reasonably fast and doesn't require any further mapping information, as long as you make sure that the field names in the classes match the field names in the tables it works. But I'm stuck on not being allowed to access the fields in the classes from a 'foreign' class, it simply doesn't allow it. So I'm forced to make all those fields public, and that isn't the way things are meant to work. Java doesn't seem to have a way to say 'this class is a friend' other than putting the classes in the same package, or by deriving the class that has access from the class that you wish to modify (and that isn't an option because that would mean the storage class would have to derive from every object that you wish to store).