ORMLite is making new instances for objects that already exist. What am I doing wrong?

27 views
Skip to first unread message

Arthur C.R.

unread,
Jun 29, 2016, 11:25:26 AM6/29/16
to ORMLite Android Users
I've made this example/test app: https://github.com/arthurrauter/ormlite-android to evaluate ORMLite as a possible ORM to a bigger project.

I have Users and they have Artworks (a one-to-many relationship). I manually created some Users and some Artworks objects (all Artworks belonging to the same User) and added them to the database. When I query for all Users, I get a List of Users as I would expect: One instance of User for each User and one instance of Artwork for each Artwork. Each instance of Artwork points back to the same instance of User. However, when I query for all the Artworks, I get one instance of Artwork for each Artwork BUT each Artwork refers to a different instance of User (when in fact they should all point to the same instance). Is this normal behaviour?
Reply all
Reply to author
Forward
0 new messages