Do grails domain classes have to be tied to a database?

后端 未结 4 1375
不知归路
不知归路 2021-01-02 12:31

I am a complete noob when it comes to grails (and still very noobish when it comes to groovy) so I apologise if this is a dumb question.

I am building a simple web a

4条回答
  •  被撕碎了的回忆
    2021-01-02 13:31

    A couple of ways to do this.

    First, you can declare your properties that map to file system data as transient, and go to file system when getters / setters are called (you have to override them). You can also load them using onLoad if you need them to be in memory always.

    Second - Hibernate handles the persistence. Hibernate allows for you to define your own user type, which can handle the persistence whichever way you want. This way it might happen for you more transparently (though you'd have to make sure you understand hibernate fairly well, to make sure there aren't any side effects, I am not sure).

    http://i-proving.com/space/Technologies/Hibernate/User+Types+in+Hibernate

提交回复
热议问题