Olog / olog-service

Olog Java EE logbook service
http://olog.github.com
MIT License
1 stars 6 forks source link

Problem when creating logbooks and tags #22

Closed dejande closed 8 years ago

dejande commented 8 years ago

Hello.

If I create a logbook and then delete it changes the state to inactive. When I list all logbooks inactive ones are not present on this list which is fine. The problem occurs when I want to create a tag that has the same name as one of the inactive logbooks. I get the following error:

Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'Injector' for key 'name' Error Code: 1062 Call: INSERT INTO logbooks (name, STATE, is_tag) VALUES (?, ?, ?) bind => [3 parameters bound] Query: InsertObjectQuery(edu.msu.nscl.olog.Tag@14c2fb73)

This of course also goes in the other direction when I want to create tags.

shroffk commented 8 years ago

Hello, In Olog data is not really deleted...a logbook/tag that is deleted is actually just marked as Inactive and thus it isn't possible to create a tag with the same name as a logbook even though the logbook has been deleted. (since the name of the logbook/tag is the primary key)

In addition with keeping up with DOE recording requirements by not deleting these logbooks weensure that historic log entries continue to be consistent. You can still search for logbook no longer active.

dejande commented 8 years ago

I understand that. But would it be possible to return a meaningful error in a case user wants to e.g. create a tag name with the name equal to the inactive logbook name?

shroffk commented 8 years ago

24