Project

General

Profile

feature request #7368

cdm entities report persistence state

Added by Andreas Kohlbecker 8 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Priority14
Category:
cdmlib
Target version:
Start date:
04/25/2018
Due date:
% Done:

100%

Severity:
normal

Description

all cdm entities should have method to report if the object is persisted or not.


public boolean  isPersisted(){
  return id != 0;
}

By this cluttering application code with if(myCdmEntitiy.getId() != 0) {...} can be avoided and replaced with a more meaningful method call. 'if(myCdmEntitiy.isPersisted()) {...}'

This should be implemented into CdmBase.

Associated revisions

Revision 57f91fb2 (diff)
Added by Andreas Kohlbecker 8 months ago

fix #7368 implementing isPersisted() in CdmBase

Revision 6e5fc434 (diff)
Added by Andreas Kohlbecker 8 months ago

ref #7368 isPersisted() @Transient and doc

Revision 74c56b97 (diff)
Added by Andreas Müller 8 months ago

ref #7368 add transient also to CdmBase.isPersited

History

#1 Updated by Andreas Kohlbecker 8 months ago

  • Description updated (diff)

#2 Updated by Andreas Kohlbecker 8 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50

#3 Updated by Andreas Kohlbecker 8 months ago

  • Assignee changed from Andreas Kohlbecker to Andreas Müller

please review

#4 Updated by Andreas Müller 8 months ago

  • Status changed from Resolved to Feedback
  • Priority changed from New to Priority14

Generally ok, but I guess we should add @Transient.

#5 Updated by Andreas Müller 8 months ago

  • Assignee changed from Andreas Müller to Andreas Kohlbecker

#6 Updated by Andreas Müller 8 months ago

Maybe we should also add a comment that it does not necessarily mean that there is a database record already but maybe the object was only saved to a persistence session. But maybe this is clear anyway.

#7 Updated by Andreas Kohlbecker 8 months ago

Andreas Müller wrote:

I guess we should add @Transient.

Agreed!

Maybe we should also add a comment that it does not necessarily mean that there is a database record already but maybe the object was only saved to a persistence session. But maybe this is clear anyway.

I think this is clear anyway but adding your sentence does not hurt and may avoid irritation.

#8 Updated by Andreas Kohlbecker 8 months ago

  • Status changed from Feedback to Resolved
  • Assignee changed from Andreas Kohlbecker to Andreas Müller

Done!

#9 Updated by Andreas Müller 8 months ago

  • Status changed from Resolved to Closed
  • Assignee changed from Andreas Müller to Andreas Kohlbecker

I don't think @Transient is enough on the interface therefore I also added it to CdmBase.

#10 Updated by Andreas Müller 8 months ago

  • % Done changed from 50 to 100

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)