Can not save new record with the sample code... #449
Answered
by
lvca
frank-dkvan
asked this question in
Q&A
-
Below is the sample code to create a new document. after the code execution, But I can not find the record in database thru SQL like "select from Customer" try( Database db = databaseFactory.open(); ){
db.transaction( () -> {
// CREATE A CUSTOMER INSTANCE
MutableDocument customer = db.newDocument("Customer");
customer.set("name", "Jay");
customer.set("surname", "Miner");
});
} I found I have to add one more code "customer.save()" if I want to find the record in database. try( Database db = databaseFactory.open(); ){
db.transaction( () -> {
// CREATE A CUSTOMER INSTANCE
MutableDocument customer = db.newDocument("Customer");
customer.set("name", "Jay");
customer.set("surname", "Miner");
customer.save();
});
} |
Beta Was this translation helpful? Give feedback.
Answered by
lvca
Jul 10, 2022
Replies: 1 comment 1 reply
-
Correct, until you hit the |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
lvca
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Correct, until you hit the
.save()
method the record is not persistent.