CMDBuild Forum

Cant delete a Domain

Hi guys,

 

I'm trying to build a cmdb using cmdbuild. All the installation was done with a demo db. Everything is working just ok so far. The thing is I did create a few classes and domains (linking one class to another)... and now I want to delete a domain but cmdbuild gives me an error message (bellow):

 

Call: services/json/schema/modclass/deletedomain
-------------------------------------------------
Error: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [SELECT * FROM cm_delete_domain(?)]; SQL state [P0001]; error code [0]; ERROR: CM_CONTAINS_DATA; nested exception is org.postgresql.util.PSQLException: ERROR: CM_CONTAINS_DATA
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:602)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:665)
	at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:673)
	at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:728)
	at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:748)
	at org.cmdbuild.dao.driver.postgres.EntryTypeCommands.deleteDomain(EntryTypeCommands.java:592)
	at org.cmdbuild.dao.driver.postgres.PostgresDriver.deleteDomain(PostgresDriver.java:140)
	at org.cmdbuild.dao.view.DBDataView$4.visit(DBDataView.java:377)
	at org.cmdbuild.dao.entrytype.DBDomain.accept(DBDomain.java:122)
	at org.cmdbuild.dao.view.DBDataView.delete(DBDataView.java:368)
	at org.cmdbuild.logic.data.DataDefinitionLogic.deleteDomainByName(DataDefinitionLogic.java:488)
	at org.cmdbuild.servlets.json.schema.ModClass.deleteDomain(ModClass.java:563)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.cmdbuild.servlets.JSONDispatcher.dispatch(JSONDispatcher.java:94)
	at org.cmdbuild.servlets.JSONDispatcher.doPost(JSONDispatcher.java:54)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.cmdbuild.filters.AuthFilter.doFilter(AuthFilter.java:144)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.cmdbuild.filters.PatchManagerFilter.doFilter(PatchManagerFilter.java:33)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.cmdbuild.filters.ConfCheckFilter.doFilter(ConfCheckFilter.java:31)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.cmdbuild.filters.TranslationFilter.doFilter(TranslationFilter.java:39)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
Caused by: org.postgresql.util.PSQLException: ERROR: CM_CONTAINS_DATA
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:560)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:302)
	at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
	at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
	at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:643)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:586)
	... 48 more


I alread deleted all card for those classes involved with those domains but no luck so far. Any help will be appreciated.
thx,


Sergio

Hi,

the deletion of the card is just logical, so you cant delete a domain if you have inserted relations in that domains, also if you have already deleted it.

Previously Tecnoteca wrote:

Hi,
the deletion of the card is just logical, so you cant delete a domain if you have inserted relations in that domains, also if you have already deleted it.

 

How can I delete it physically? I mean .. let`s say I have created a Domain with wrong info .. and now I want to create it with the right data.
thx,
sergio
We have the same problem. Created two classes und linked it with an domain. After that we created a Attribute und referenced it to the Domain.
Now we can not delete the Domain. Logically clear because of the attribute which is referenced. So we tried to delete the attribute but also with no success. cmdbuild said, that we can't delete attributes with data. but there is no data, no cards!
 
Is there actually any way to delete a Domain or an attribute withtype "reference"?translate
 
Previously Sergio wrote:
Previously Tecnoteca wrote:
Hi,
the deletion of the card is just logical, so you cant delete a domain if you have inserted relations in that domains, also if you have already deleted it.

 

How can I delete it physically? I mean .. let`s say I have created a Domain with wrong info .. and now I want to create it with the right data.
thx,
sergio

 

CMDBuild performs a full versioning of all the cards and all the relationships whenever they are changed / deleted (you can see them in the TAB History).
So even if you delete a card or a relationship, it remains in the database and prevents you from delete the table (class or domain) where it is stored.

The simplest solution is to delete the class / domain only logically (by setting it not active), instead of physically, and create another class / domain with a different name.
Otherwise you should go directly in the database and perform
manually the deletions with SQL queries.
But this is a very dangerous operation (the database may become inconsistent) and is only recommended for advanced users.

CMDBuild Team

So you're saying that there is no way to allow for mistakes in the setup of the CMDB - the only allowance is to mark mistakes as inactive?  I'm just starting to look at this product and this could become an administrative nightmare!

How do people get the design right "the first time"?

 

 

 

Previously Tecnoteca wrote:

CMDBuild performs a full versioning of all the cards and all the relationships whenever they are changed / deleted (you can see them in the TAB History).
So even if you delete a card or a relationship, it remains in the database and prevents you from delete the table (class or domain) where it is stored.

The simplest solution is to delete the class / domain only logically (by setting it not active), instead of physically, and create another class / domain with a different name.
Otherwise you should go directly in the database and perform
manually the deletions with SQL queries.
But this is a very dangerous operation (the database may become inconsistent) and is only recommended for advanced users.

CMDBuild Team

 

 

Surely is not a good idea to create the data model “by trial”.
T
he best solution is to study the data model using an ER editor and then configure it in CMDBuild when it is sufficiently stable.
However, until you enter data is still possible remove classes, attributes or domains.
CMDBuild Team