CMDBuild Forum

Error about "ORM_UNIQUE_VIOLATION"

Hi,

I have encountered an error "ORM_UNIQUE_VIOLATION" when saving a card record.

For example, a class called "Asset_Employee" including the following attributes:

- ID (integer)

- Description (string)

- IssueDate (Date)

- Equipment_1 (reference to Monitor domain)

- Equipment_2 (reference to Monitor domain)

If I set value to "Equipment_1" and then save, same value will be assigned to "Equipment_2" too.

I would like to know whether CMDBuild allows to add more than one attribute with same domain? or any workaround if I want to keep record like this?

Thanks.

 

You can not have a single class of two CMDBuild reference on the same domain.
The solution is to create a domain for each reference.
Possibly also the error
"ORM_UNIQUE_VIOLATION" and the wrong assignments depend on this issue.
CMDBuild Team

 

 

Hi Tecnoteca,
 
Thanks for your reply.
 
For the above sample, each employee has two monitors. It is the reason why I need to have more than one reference to the same domain. If I create two Monitor domains with the same information, it looks so strange. Except monitor, I still have some other attributes may require to have more than one reference record, do you have any other suggestion?
 
Previously Tecnoteca wrote:
You can not have a single class of two CMDBuild reference on the same domain.
The solution is to create a domain for each reference.
Possibly also the error
"ORM_UNIQUE_VIOLATION" and the wrong assignments depend on this issue.
CMDBuild Team

 

 

 

If the employee has a technical manager and an administrative manager you need two reference on the same "Personnel" class.
if an employee has two or three or "n" monitors you need to create a class "Monitor" and domain 1: N between "Employee" and "Monitor".
Perhaps it is also better to create an "Asset" superclass and the "Computer" / "Printer" / "Monitor" / etc subclasses.
CMDBuild Team
Hi,
 
I did create the domain 1:N between "Employee" and "Monitor".

Example

------------

Class 1: Monitor (Inherits from "Hardware" and "Hardware" Inherits from "Asset")

- Code (string)

- Name (string)

 

Class 2: Employee (Inherits from "Class")

- Code (string)

- Name (string)

- Monitor1(reference, added after creating "MonitorToEmployee")

- Monitor2(reference, added after creating "MonitorToEmployee")

  

Domain MonitorToEmployee

- Origin: Monitor

- Destination: Employee

- Description direct: assigned to

- Description inverse: owns

- Cardinality: 1:N

- M/D: Yes

- Active: Yes

 
When I go to data management page to add new employee, Monitor1 and Monitor2 also have a list of monitor to drop-down for selection. However, when I save the record, it will prompt "ORM_UNIQUE_VIOLATION" error.
 
Am I missing any steps for creating the relationship between "Employee" and "Monitor"? How can i make "an employee has two or three or "n" monitors"?
 
And I have another question about the database. As the webpage is not allowed to delete an attribute once there are related records added, I did try to delete the wrongly added column from the database directly, e.g. I removed column "Equipment1" from table "AssetAssignee" and the related trigger functions. The program still runs without any error, but I want to know whether this action will affect other part of the system?
 
Thanks for your help.
 
Previously Tecnoteca wrote:
If the employee has a technical manager and an administrative manager you need two reference on the same "Personnel" class.
if an employee has two or three or "n" monitors you need to create a class "Monitor" and domain 1: N between "Employee" and "Monitor".
Perhaps it is also better to create an "Asset" superclass and the "Computer" / "Printer" / "Monitor" / etc subclasses.
CMDBuild Team

 

- Origin: Monitor

- Destination: Employee

- Cardinality: 1:N

 

One monitor can be assigned to many employees ?

 

CMDBuild Team

Hi,
If I set only 1 "Monitor" attribute in Employee, it is no problem. And one monitor can be assigned to different Employees too. However, the result I want is one Employee can own more than one Monitor.
 
For example, Employee class

- ID (integer)

- Description (string)

- IssueDate (Date)

- Monitor_1 (reference to Monitor domain)

- Monitor_2 (reference to Monitor domain)

 

I did try to create the domain like below:

- Origin: Monitor

- Destination: Employee

- Cardinality: N:1

But the reference drop down is empty.

Would you show the sample how to create a class with "one employee contains more than one monitor"?

 

Previously Tecnoteca wrote:

- Origin: Monitor

- Destination: Employee

- Cardinality: 1:N

 

One monitor can be assigned to many employees ?

 

CMDBuild Team

 

Hi,
 
Any recommended solution?
 
Previously Wing Man wrote:
Hi,
If I set only 1 "Monitor" attribute in Employee, it is no problem. And one monitor can be assigned to different Employees too. However, the result I want is one Employee can own more than one Monitor.
 
For example, Employee class

- ID (integer)

- Description (string)

- IssueDate (Date)

- Monitor_1 (reference to Monitor domain)

- Monitor_2 (reference to Monitor domain)

 

I did try to create the domain like below:

- Origin: Monitor

- Destination: Employee

- Cardinality: N:1

But the reference drop down is empty.

Would you show the sample how to create a class with "one employee contains more than one monitor"?

 

Previously Tecnoteca wrote:

- Origin: Monitor

- Destination: Employee

- Cardinality: 1:N

 

One monitor can be assigned to many employees ?

 

CMDBuild Team

 

 

I suggest you look at how it is modeled the relationship between Monitor and Employee in the online demo database.
CMDBuild Team