Skip Headers

# Adding New Objects to the Database With a Session Query

Previous

Next

The `insertObject` method creates a new object in the database, but does not perform the does-exist check before it attempts the insert operation. The `insertObject` method is more efficient than the `writeObject` method if you are certain that the object does not yet exist in the database. If the object does exist, the database throws an exception when you execute the `insertObject` method.