Package com.mongodb

Examples of com.mongodb.MongoException$Network


                objectMapper.writerWithView(view).writeValue(generator, object);
            } catch (JsonMappingException e) {
                throw new MongoJsonMappingException(e);
            } catch (IOException e) {
                // This shouldn't happen
                throw new MongoException(
                        "Unknown error occurred converting BSON to object", e);
            }
            return generator.getDBObject();
        }
    }
View Full Code Here


                    this, dbObject, objectMapper), type);
        } catch (JsonMappingException e) {
            throw new MongoJsonMappingException(e);
        } catch (IOException e) {
            // This shouldn't happen
            throw new MongoException(
                    "Unknown error occurred converting BSON to object", e);
        }
    }
View Full Code Here

                    dbObject, objectMapper), clazz);
        } catch (JsonMappingException e) {
            throw new MongoJsonMappingException(e);
        } catch (IOException e) {
            // This shouldn't happen
            throw new MongoException(
                    "Unknown error occurred converting BSON to object", e);
        }
    }
View Full Code Here

        executed = true;
    }

    private void checkExecuted() {
        if (executed) {
            throw new MongoException(
                    "Cannot modify query after it's been executed");
        }
    }
View Full Code Here

     * @throws MongoException
     *             If no objects were saved
     */
    public T getSavedObject() {
        if (dbObjects.length == 0) {
            throw new MongoException("No objects to return");
        }
        return getSavedObjects().get(0);
    }
View Full Code Here

     * @throws MongoException
     *             If no objects were saved
     */
    public K getSavedId() {
        if (dbObjects.length == 0) {
            throw new MongoException("No objects to return");
        }
        if (dbObjects[0] instanceof JacksonDBObject) {
            throw new UnsupportedOperationException(
                    "Generated _id retrieval not supported when using stream serialization");
        }
View Full Code Here

     * @throws MongoException
     *             If no objects were saved
     */
    public DBObject getDbObject() {
        if (dbObjects.length == 0) {
            throw new MongoException("No objects to return");
        }
        return dbObjects[0];
    }
View Full Code Here

                // number of bytes to the stream
                generator.close();
            } catch (JsonMappingException e) {
                throw new MongoJsonMappingException(e);
            } catch (IOException e) {
                throw new MongoException("Error writing object out", e);
            }
            return stream.getCount();
        } else {
            return defaultDBEncoder.writeObject(buf, object);
        }
View Full Code Here

            try {
                return jsonDeserializer
                        .deserialize(new BsonObjectTraversingParser(null, dbId,
                                objectMapper), null);
            } catch (IOException e) {
                throw new MongoException("Error deserializing ID", e);
            }
        }
View Full Code Here

        public D toDbId(K id) {
            BsonObjectGenerator generator = new BsonObjectGenerator();
            try {
                jsonSerializer.serialize(id, generator, null);
            } catch (IOException e) {
                throw new MongoException("Error serializing ID", e);
            }
            return (D) generator.getValue();
        }
View Full Code Here

TOP

Related Classes of com.mongodb.MongoException$Network

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.