cborm
Install
v4.x
v4.x
  • Introduction
  • Intro
    • Release History
      • What's New With 4.5.0
      • What's New With 4.4.0
      • What's new With 4.3.x
      • What's New With 4.2.0
      • What's New With 4.1.0
      • What's New With 4.0.0
    • About This Book
      • Author
  • Getting Started
    • Overview
    • Installation
    • Basic Crud - Services
    • Basic Crud - ActiveEntity
  • Base ORM Service
    • Overview
    • Service Properties
    • Concrete Services
    • Service Methods
      • Criteria Queries
        • getRestrictions
        • newCriteria
      • Creation - Population
        • new
        • populate
        • populateFromJSON
        • populateFromQuery
        • populateFromXML
      • Counters
        • count
        • countWhere
        • exists
      • Deleting Entities
        • delete
        • deleteAll
        • deleteByID
        • deleteByQuery
        • deleteWhere
      • Entity Convenience Methods
        • getDirtyPropertyNames
        • getEntityGivenName
        • getEntityMetadata
        • getKey
        • getKeyValue
        • getPropertyNames
        • getTableName
        • isDirty
        • refresh
      • Finders
        • findit
        • findOrFail
        • findByExample
        • findWhere
        • findAll
        • findAllWhere
      • Getters
        • get
        • getOrFail
        • getAll
      • ORM Session
        • clear
        • evict
        • evictCollection
        • evictQueries
        • getSessionStatistics
        • isSessionDirty
        • merge
        • sessionContains
      • Querying
        • executeQuery
        • list
      • Saving Entities
        • save
        • saveAll
      • Utility Methods
        • autoCast
        • createService
        • idCast
        • nullValue
        • when
    • Dynamic Finders+Counters
      • Method Signatures
      • Method Expressions
      • Query Options
    • Automatic Java Types
  • Virtual Services
    • Overview
    • Service Properties
    • Concrete Virtual Services
  • Active Record
    • Active Entity Overview
    • Constructor Properties
    • Usage
    • Validation
  • Criteria Queries
    • Criteria Builder
      • Getting Started
      • Restrictions
        • Value Casting
        • SQL Restrictions
      • Modifiers
      • Results
      • Associations
      • Projections & Aggregates
    • Detached Criteria Builder
      • Getting Started
      • Projections
      • Subqueries
      • DetachedSQLProjection()
      • Criterias
      • Associations
    • Help! I'm Not Getting the Result I expected!
  • Advanced Features
    • Automatic REST Crud
    • Hibernate Logging
    • Mementifier
    • ORM Events
      • Custom Event Handler
    • Unique Property Validation
Powered by GitBook
On this page
  • Returns
  • Arguments
  • Examples

Was this helpful?

Edit on GitHub
Export as PDF
  1. Base ORM Service
  2. Service Methods
  3. Creation - Population

new

Get a new entity object by entity name. You can also pass in a structure called properties that will be used to populate the new entity with or you can use optional named parameters to call setters within the new entity to have shorthand population.

Returns

  • This function returns the newly created entity

Arguments

Key

Type

Required

Default

Description

entityName

any

true

---

properties

struct

false

{}

A structure of name-value pairs to populate the new entity with

composeRelationships

boolean

false

true

Automatically attempt to compose relationships from the incoming properties memento

nullEmptyInclude

string

false

---

A list of keys to NULL when empty

nullEmptyExclude

string

false

---

A list of keys to NOT NULL when empty

ignoreEmpty

boolean

false

false

Ignore empty property values on populations

include

string

false

---

A list of keys to include in the population from the incoming properties memento

exclude

string

false

---

A list of keys to exclude in the population from the incoming properties memento

Examples

// return empty post entity
var post = ormService.new("Post");
var user = ormService.new(entityName="User",properties={firstName="Luis", lastName="Majano", age="32", awesome=true});
var user = ormService.new("User",{fname="Luis",lname="Majano",cool=false,awesome=true});
PreviousCreation - PopulationNextpopulate

Last updated 2 years ago

Was this helpful?