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

Strange behavior of command 'DELETE' #7291

Closed
schernolyas opened this issue Mar 31, 2017 · 15 comments
Closed

Strange behavior of command 'DELETE' #7291

schernolyas opened this issue Mar 31, 2017 · 15 comments
Assignees
Labels

Comments

@schernolyas
Copy link

schernolyas commented Mar 31, 2017

OrientDB Version: 3.0.0-SNAPSHOT

Java Version: 1.8

OS: Ubuntu 16.10

Expected behavior

Actual behavior

Execute query:
[main] 15:30:32,248 DEBUG org.hibernate.ogm.datastore.orientdb.dialect.impl.OrientDBAssociationQueries: removeAssociation: query for loading document for remove: DELETE FROM Car_owners WHERE Car_bKey=1  
[main] 15:30:32,248 DEBUG org.hibernate.ogm.datastore.orientdb.utils.NativeQueryUtil: executeNonIdempotentQuery: NonIdempotentQuery: DELETE FROM Car_owners WHERE Car_bKey=1 
[main] 15:30:32,257 DEBUG org.hibernate.ogm.datastore.orientdb.utils.NativeQueryUtil: executeNonIdempotentQuery: result: {"@type":"d","@version":0,"count":4,"@fieldTypes":"count=l"}

The query must be delete entities with attr name = 'name1','name2'
After it, I execute query:

[main] 15:30:32,259 DEBUG org.hibernate.ogm.datastore.orientdb.dialect.impl.OrientDBAssociationQueries: findRelationship: queryBuilder: SELECT FROM Car_owners WHERE Car_bKey=1  AND active=false  AND name='name1' 
[main] 15:30:32,261 DEBUG org.hibernate.ogm.datastore.orientdb.utils.NativeQueryUtil: load documents: 0
[main] 15:30:32,261 DEBUG org.hibernate.ogm.datastore.orientdb.dialect.impl.OrientDBAssociationQueries: findRelationship: found: 0

Works fine. Execute next query:

[main] 15:30:32,264 DEBUG org.hibernate.ogm.datastore.orientdb.dialect.impl.OrientDBAssociationQueries: findRelationship: queryBuilder: SELECT FROM Car_owners WHERE Car_bKey=1  AND active=false  AND name='name2' 
[main] 15:30:32,265 DEBUG org.hibernate.ogm.datastore.orientdb.utils.NativeQueryUtil: NonIdempotentQuery: loaded document: {"@type":"d","@rid":"#18:0","@version":1,"@class":"Car_owners","Car_bKey":1,"name":"name2","active":false,"@fieldTypes":"Car_bKey=l"}
[main] 15:30:32,265 DEBUG org.hibernate.ogm.datastore.orientdb.utils.NativeQueryUtil: load documents: 1
[main] 15:30:32,266 DEBUG org.hibernate.ogm.datastore.orientdb.dialect.impl.OrientDBAssociationQueries: findRelationship: found: 1

Why 'delete' command delete only one entity?

_____________________________________________________________
method for execute 'delete'
public static ODocument executeNonIdempotentQuery(ODatabaseDocument db, String query) {
		log.debugf( "executeNonIdempotentQuery: NonIdempotentQuery: %s", query );
		ODocument result  = null;
		try ( OResultSet resultSet = db.command( query ) ) {
			result  = (ODocument) resultSet.next().toElement();
			log.debugf( "executeNonIdempotentQuery: result: %s", result.toJSON() );
		}
		catch (OCommandSQLParsingException e1) {
			throw log.cannotParseQuery( query, e1 );
		}
		catch (OCommandExecutionException e2) {
			throw log.cannotExecuteQuery( query, e2 );
		}
		return result;
	}
____________________________________________________________________

Steps to reproduce

  1. Insert two documents
  2. Open transaction
  3. Delete all documents by command 'delete'
  4. Try to select one document
  5. Try to select other document
  6. Commit transaction
@schernolyas schernolyas changed the title Strange behavior of commend 'DELETE' Strange behavior of command 'DELETE' Mar 31, 2017
@luigidellaquila luigidellaquila self-assigned this Apr 2, 2017
@luigidellaquila
Copy link
Member

Hi @schernolyas

Do you have any indexes on the properties?

Thanks

Luigi

@luigidellaquila
Copy link
Member

Hi @schernolyas

I guess your bugs are related to this project

https://github.com/schernolyas/hibernate-ogm

I tried to clone it but it doesn't compile... any advice on how to build and test?

Thanks

Luigi

@schernolyas
Copy link
Author

Hi @luigidellaquila !

Thanks that You review my code.

Please look to https://github.com/schernolyas/hibernate-ogm/tree/ogm-855-migration-orientdb3-dev1 .

I am doing migration to OrientDB in the branch ogm-855-migration-orientdb3-dev1. Module 'orientdb'

@luigidellaquila
Copy link
Member

Great, trying it now.

Is there any specific test I can run to reproduce existing issues?

Thanks

Luigi

@luigidellaquila
Copy link
Member

mmm... I just tried to build it from the root dir with the following:

mvn clean install -DskipITs -DskipDocs -DskipDistro -s settings-example.xml

but I got an error:

[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project org.hibernate.ogm:hibernate-ogm-orientdb-remote:5.1.0-SNAPSHOT (/Users/luigidellaquila/apps/hibernate-ogm/orientdb-remote/pom.xml) has 4 errors
[ERROR]     'dependencies.dependency.version' for org.hibernate.ogm:hibernate-ogm-orientdb:jar is missing. @ line 60, column 21
[ERROR]     'dependencies.dependency.version' for org.jboss.byteman:byteman:jar is missing. @ line 135, column 21
[ERROR]     'dependencies.dependency.version' for org.jboss.byteman:byteman-bmunit:jar is missing. @ line 140, column 21
[ERROR]     'dependencies.dependency.version' for org.jboss.byteman:byteman-install:jar is missing. @ line 145, column 21

Am I missing something?

Thanks

Luigi

@schernolyas
Copy link
Author

schernolyas commented Apr 4, 2017

Use the command "mvn clean install -pl orientdb -am -DskipTests=true"

@luigidellaquila
Copy link
Member

still no luck...

mvn clean install -pl orientdb-remote -am -DskipTests=true

[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project org.hibernate.ogm:hibernate-ogm-orientdb-remote:5.1.0-SNAPSHOT (/Users/luigidellaquila/apps/hibernate-ogm/orientdb-remote/pom.xml) has 4 errors
[ERROR]     'dependencies.dependency.version' for org.hibernate.ogm:hibernate-ogm-orientdb:jar is missing. @ line 60, column 21
[ERROR]     'dependencies.dependency.version' for org.jboss.byteman:byteman:jar is missing. @ line 135, column 21
[ERROR]     'dependencies.dependency.version' for org.jboss.byteman:byteman-bmunit:jar is missing. @ line 140, column 21
[ERROR]     'dependencies.dependency.version' for org.jboss.byteman:byteman-install:jar is missing. @ line 145, column 21
[ERROR] 

@schernolyas
Copy link
Author

mmm .... Did you checkout branch 'ogm-855-migration-orientdb3-dev1'?

Try command ' mvn clean install -pl orientdb -am -DskipTests=true'

@schernolyas
Copy link
Author

Also ... @luigidellaquila look to org.hibernate.ogm.datastore.orientdb.utils.SequenceUtil
How I can execute function?

@schernolyas
Copy link
Author

@luigidellaquila please get new version

@luigidellaquila
Copy link
Member

Yes I did, but still no luck...

schermata 2017-04-04 alle 17 11 20

@schernolyas
Copy link
Author

it strange. okey I will recheck it.

@schernolyas
Copy link
Author

schernolyas commented Apr 4, 2017

now " mvn clean install -pl orientdb-remote -am -DskipTests=true" not compiled.
Please get my last changes.

@schernolyas
Copy link
Author

HI @luigidellaquila !
I think We can close the issue.

@luigidellaquila
Copy link
Member

Great, thanks!

Luigi

@santo-it santo-it added question and removed bug labels Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants