user903772
user903772

Reputation: 1562

Grails Entity without persist

I have a domain class in grails... How do I get gorm to leave out this entity when it create the db? Just leave it alone.

Upvotes: 5

Views: 4085

Answers (3)

jenk
jenk

Reputation: 1043

If i understood, u want not create table from domain class? If yes, use this code inside domain class:

static mapWith = "none" // disable persisting into database

Upvotes: 14

Patrick
Patrick

Reputation: 2122

You could use Command Objects.

http://grails.org/doc/latest/guide/single.html#commandObjects

They provide the data binding and validation of domain classes, but do not map to the database.

Upvotes: 2

Jarred Olson
Jarred Olson

Reputation: 3243

Sounds like you don't need it to be a domain class then. You could just make it a POGO in the src/groovy file. If my assumptions here are wrong please explain further what you're trying to accomplish.

Upvotes: 9

Related Questions