Domain Objects are objects made for dealing with the domain logic at the Model layer. These objects generally simulate real (or virtual) items from real-life: Person, Post, Document, etc.
Questions tagged [domain-object]
98 questions
5
votes
1 answer
How do I initialise a Date field in a Grails domain object to act as a timestamp?
I have a domain class which has two dates in it and I want one of them populated with the current time when a record is created for the object, like a create timestamp...
class Contact {
Date initiatedDate
Date acceptedDate
}
Is it…

Simon
- 78,655
- 25
- 88
- 118
4
votes
2 answers
Service contracts vs. domain objects
Say I have two interfaces to my application:
A web front-end
A back-end which provides data
Both of them talk to a web-service, and that web-service in turn, handles business logic and talks to a separate data layer, which persists the…

Jonathan
- 32,202
- 38
- 137
- 208
4
votes
2 answers
Service Layer validation vs. Domain Object validation; potential "abuse" of Domain Objects?
I've seen lots of book and article examples saying to put validation code in your Service Layer. Keep the Domain Objects "dumb" (aka, pure POCO's) and handle all validation that a Domain Object might do in the Service Layer.
The Service Layer is…

Michael McCarthy
- 1,502
- 3
- 18
- 45
4
votes
2 answers
Grails named queries not working with "in" statement
I have a Grails application (2.2.4). Where in domain class I have looks like this
class Author implements Serializable {
....
static hasMany = [
book : Book
]
static namedQueries = {
hasGenre {genreNameList ->
…

Visahan
- 1,130
- 2
- 14
- 35
4
votes
4 answers
Constructing a Domain Object from multiple DTOs
Suppose you have the canonical Customer domain object. You have three different screens on which Customer is displayed: External Admin, Internal Admin, and Update Account.
Suppose further that each screen displays only a subset of all of the data…

moffdub
- 5,284
- 2
- 35
- 32
4
votes
1 answer
Is this a valid use of Grails transients?
I have a domain object on which I want to store a few things which only exist at runtime. I looked at the documentation and found the transients keyword, which, on the face of it was what I was looking for. Here is what my domain object looks…

Simon
- 78,655
- 25
- 88
- 118
3
votes
1 answer
How do I convert Money based on FX rates in a domain object without Service Location
This link describes a function on a Money object for adding funds together of different currencies.
First I do not want to use the Service Locator pattern. I currently use a pattern of not having the Money object do the conversion itself. It just…

phil
- 618
- 2
- 5
- 17
3
votes
2 answers
Should child entity classes have their own repositories?
I have several classes inheriting from an Admin class: Manager, Translator, etc.
Admin is an aggregate, so should have its own Repository. However, some methods to find Managers or Translators might be specific to these classes. Others might be…

BenMorel
- 34,448
- 50
- 182
- 322
3
votes
2 answers
Should I use my ORM generated objects as my domain object?
My ORM is generating objects reflecting the database table structure. This objects are extensible, so I'm able to add new properties and methods. This objects do not contains any persistence logic,so I guess they are persistant ignorant.
Should I…

user256034
- 4,289
- 5
- 37
- 44
3
votes
2 answers
Domain Model or Domain Object ? - Definitions
Please correct me if I'm wrong.
We may say Domain Model to represent:
a) The M part of a MVC structure, having on the M part, a Domain Driven Design pattern applied.
b) A scheme of entities, their attributes and relationships in a certain way. Could…

MEM
- 30,529
- 42
- 121
- 191
3
votes
1 answer
Serialize Domain instance with service injected?
I have a Domain object that tracks the user that created, deleted and modified it using the injected Spring Security service, def springSecurityService. Instances of these objects are saved in the session and in production the session is persisted…

user1452701
- 144
- 1
- 10
3
votes
5 answers
How do you use Interfaces with the Factory Pattern in Domain-Driven Design?
Does it make sense to use interfaces for your domain object factories by default, or should interfaces be reserved for the factory classes only when you need them?
public IUserFactory
{
User CreateNewUser();
}
public UserFactory :…

Mark Rogers
- 96,497
- 18
- 85
- 138
3
votes
1 answer
Grails Domains - Multiple many to many relationships
I'm running with grails 3.1.4 and having trouble creating a schema that allows me to tie multiple domain objects to several other domain objects. As an example of what I'm trying to do:
I have three classes. Books, Authors, and ReadingLists.…

Tonyvolo
- 31
- 1
3
votes
2 answers
Grails domain Named query for a list of string
I have a simple Grails application. I have domains as below
class Author implements Serializable {
....
static hasMany = [
book : Book
]
}
class Book implements Serializable{
Author author
Genres genres
static belongsTo…

Visahan
- 1,130
- 2
- 14
- 35
3
votes
1 answer
Unit of Work pattern, getters, setters and contracts (PHP)
I'm not sure if the title is the best way to describe this question.
This book - http://apress.com/book/view/9781590599099 - illustrates an implementation of the Unit of Work pattern. It goes a little something like this.
class UoW(){
private…

sunwukung
- 2,815
- 3
- 41
- 56