orientdb icon indicating copy to clipboard operation
orientdb copied to clipboard

exception creating properties on Links

Open SafwanHak opened this issue 12 years ago • 6 comments

1.7, If you create properties on an edge, you get the following exception. The Proerties on edge is being configured before any edges of this type are created. Follow the script below to reproduce.

orientdb {touca}> create property speaks.out LINK;

Error: com.orientechnologies.orient.enterprise.channel.binary.OResponseProcessingException: Exception during response processing. Error: com.orientechnologies.orient.core.exception.OSchemaException: Cannot change the schema while a transaction is active. Schema changes are not transactional orientdb {touca}> create property speaks.in LINK;

Error: com.orientechnologies.orient.enterprise.channel.binary.OResponseProcessingException: Exception during response processing. Error: com.orientechnologies.orient.core.exception.OSchemaException: Cannot change the schema while a transaction is active. Schema changes are not transactional orientdb {touca}> CREATE INDEX unique_speaks ON speaks (in, out) UNIQUE;

Creating index... Error: com.orientechnologies.orient.enterprise.channel.binary.OResponseProcessingException: Exception during response processing. Error: com.orientechnologies.orient.core.exception.OCommandExecutionException: Error on execution of command: sql.create INDEX unique_speaks ON speaks (in, out) UNIQUE Error: java.lang.IllegalStateException: Cannot create a new index inside a transaction

Script:

#drop database if already exists
drop database remote:locahost/touca root pass;

#create touca database
create database remote:localhost/touca root pass local;

#reconnect
connect remote:localhost/touca root pass;

#create classes/Vectors
create class User extends V;
create class Language extends V;
create class Label extends V;
create class Email extends V;
create class City extends V;

#create Links/Edges
create class has extends E;
create class speaks extends E;
create class is extends E;
create class translatesTo extends E;
create class livesIn extends E;

#create User Data
create vertex User set name = 'Luca';
create vertex User set name = 'Joe';

#create Language Data
create vertex Language set name = 'En-uk';
create vertex Language set name = 'En-us';
create vertex Language set name = 'Fr-fr';
create vertex Language set name = 'Ru-ru';
create vertex Language set name = 'Ar-sy';

#create Label Data
create vertex Label set name = 'Hello';
create vertex Label set name = 'Salut';
create vertex Label set name = 'Ciao';
create vertex Label set name = 'Good day';
create vertex Label set name = 'Bonjour';
create vertex Label set name = 'Hallo';
create vertex Label set name = 'Marhaba';
create vertex Label set name = 'Salut2';

#emails
create vertex Email set email = '[email protected]';
create vertex Email set email = '[email protected]';

#edges for emails
create edge has from (select from User where name = 'Luca') to (select from Email where email = '[email protected]');
create edge has from (select from User where name = 'Luca') to (select from Email where email = '[email protected]');


#index
create property speaks.out LINK;
create property speaks.in LINK;
CREATE INDEX unique_speaks ON speaks (in, out) UNIQUE;

SafwanHak avatar Jan 22 '14 07:01 SafwanHak

Fixed in 1.7-SNAPSHOT

enisher avatar Jan 22 '14 15:01 enisher

Even though this error is closed, I keep getting this. Error: java.lang.IllegalStateException: Cannot create a new index inside a transaction What is meant by inside a transaction?

nishantkumar1292 avatar May 22 '17 09:05 nishantkumar1292

hi @nishantkumar1292,

the DDL operation (like create class/create property/create index) are not allowed when a transaction is running, so you cannot do

begin;
create  index ...;
commit;

with a snippet like this you will get Error: java.lang.IllegalStateException: Cannot create a new index inside a transaction

Hope this help

tglman avatar May 22 '17 10:05 tglman

I am doing this in a rails application and created a standalone function for this. But it is still giving me this error. I ran this function immediately after creating the database. Did I miss something?

nishantkumar1292 avatar May 22 '17 11:05 nishantkumar1292

Are you using oCommandScript?

Sent from my iPhone

On 22 May 2017, at 07:35, Nishant Kumar [email protected] wrote:

I am doing this in a rails application and created a standalone function for this. But it is still giving me this error. I ran this function immediately after creating the database. Did I miss something?

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.

SafwanHak avatar May 22 '17 12:05 SafwanHak

Not using oCommandScript. Using active-orient gem. ORD.execute to run the query in case of complex once.

nishantkumar1292 avatar May 23 '17 09:05 nishantkumar1292