Fast Object Database for Java - with JPA/JDO support

ObjectDB needs "insert ignore"

#1

Hi,

The command "insert ignore into" in mysql can avoid interruptions caused by program errors when the id is repeated. In a certain situation, we need to remove duplicates from a lot of duplicated data through some rule, and hashmap can do the job. But it would be nice if the database could do it with a few memory.

I agree the point in the following post, but I cannot reply it. So I have to create a repeated topic.

how to implement insert ignore in objectdb?

=========================================================================
There's never been infinity. Cantor's diagonal proof is completely wrong.
#2

The post was added as a new feature request.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Without the function "IGNORE", I have to do this for inserting:


@NamedQuery(
        name="isExistName",
        query="SELECT count(c) FROM Student c WHERE c.name = :stuName and c.sid=:stuID"
)
then run createNamedQuery("isExistName"), judge whether the student exist.

Is there an elegant method for repeated inserting?

=========================================================================
There's never been infinity. Cantor's diagonal proof is completely wrong.
#4

It is fine. However, to check if a specific primary key is in use, you may also use find or getReferemce (see this page). Use an ID class or an embedded ID as the second parameter if  you have  a composite primary key (see this page).

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#5

I've discussed "find() cost unreasonable time!".

You'd pointed this "Find is very efficient in retrieving a single entity object but less efficient when many entity objects" and "In that case - you should use a query."

in the post : https://www.objectdb.com/forum/359

=========================================================================
There's never been infinity. Cantor's diagonal proof is completely wrong.
#6

> You'd pointed this "Find is very efficient in retrieving a single entity object but less efficient when many entity objects" and "In that case - you should use a query."

That is correct, but apparently in #3 above you are checking a single object in that operation, so find is expected to be a bit faster in that case (and check also getReference, which could be faster).

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply