Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database ID not set on insert #209

Open
toddharrison opened this issue Apr 2, 2015 · 2 comments
Open

Database ID not set on insert #209

toddharrison opened this issue Apr 2, 2015 · 2 comments

Comments

@toddharrison
Copy link

When I insert a new record using:

Database.get().insert(dao);

the Integer id of the dao is never set to the record created.

@darkdiplomat
Copy link
Member

id should auto-increment, i have no clue how your object is created or what information is being passed back and forth without more detail.

@toddharrison
Copy link
Author

Sorry for the lack of details.

When I insert a new object:

Dao dao = new Dao();
dao.foo = "bar";
Database.get().insert(dao);

where Dao is an instance of DataAccess, it is saved into the database correctly. That is to say, in the database the xml has an autogenerated ID created for me and the foo is set to bar. However, in the Dao object itself, after I call insert on it, I have no way of knowing what the ID is of that record that was just created. the insert method needs to set the ID on the DataAccess after the insert completes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants