Samples

Want to get started using Forge, but now quite sure how to do the things you want? Check out some of these sample scripts for common use-cases.

Forge Quickstart

Want to see a full example, a quick-start using much of the Forge built-in scaffolding and commands? You can find the full tutorial and instructions here.

Create a new JPA @Entity class

  1. new-project —named example —topLevelPackage com.example
  2. persistence setup —provider HIBERNATE —container JBOSS_AS7
  3. entity —named SampleEntity
  4. field string —named sampleField
  5. field temporal —named createdOn —type TIMESTAMP
  6. ls

Add an @N-To-N relationship between two @Entity classes

  1. new-project —named example —topLevelPackage com.example
  2. persistence setup —provider HIBERNATE —container JBOSS_AS7
  3. entity —named Hurricane
  4. entity —named Continent
  5. field manyToMany —named hurricanes —fieldType com.example.domain.Hurricane —inverseFieldName continents
  6. ls

Create a REST endpoint from @Entity

  1. new-project —named example —topLevelPackage com.example
  2. persistence setup —provider HIBERNATE —container JBOSS_AS7
  3. rest setup
  4. entity —named SampleEntity
  5. field string —named sampleField
  6. rest endpoint-from-entity