Project

General

Profile

Actions

feature request #7368

closed

cdm entities report persistence state

Added by Andreas Kohlbecker almost 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Priority14
Category:
cdmlib
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
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.

Actions #1

Updated by Andreas Kohlbecker almost 5 years ago

  • Description updated (diff)
Actions #2

Updated by Andreas Kohlbecker almost 5 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50
Actions #3

Updated by Andreas Kohlbecker almost 5 years ago

  • Assignee changed from Andreas Kohlbecker to Andreas Müller

please review

Actions #4

Updated by Andreas Müller almost 5 years ago

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

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

Actions #5

Updated by Andreas Müller almost 5 years ago

  • Assignee changed from Andreas Müller to Andreas Kohlbecker
Actions #6

Updated by Andreas Müller almost 5 years 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.

Actions #7

Updated by Andreas Kohlbecker almost 5 years 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.

Actions #8

Updated by Andreas Kohlbecker almost 5 years ago

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

Done!

Actions #9

Updated by Andreas Müller almost 5 years 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.

Actions #10

Updated by Andreas Müller almost 5 years ago

  • % Done changed from 50 to 100
Actions

Also available in: Atom PDF