I have an existing view in a relational database and I'd like to add it as an existing entity in the model with jhipster using jdl-import. How can I mark the entity as readOnly using jdl-import generator?
Asked
Active
Viewed 1,345 times
2 Answers
4
Starting from JHipster 6.4.0, it is possible to define an Entity as readonly in JDL.
When defining you Entity in JDL, you can define it as readonly by using an annotation:
@readOnly
entity MyEnity {
}
Or by using an option:
entity MyEntity {
}
readOnly MyEntity
The release notes of 6.4.0 can be found here.
The JDL documentation also includes a section explaining hoy the readOnly
annotation/option can be used: https://www.jhipster.tech/jdl/options
Hope it helps,

Esteban Aliverti
- 6,259
- 2
- 19
- 31
1
You can't do it in JDL nor in entity sub generator, you must do it manually in code after generation.

Gaël Marziou
- 16,028
- 4
- 38
- 49
-
Do I need to add an attribute to the json generated entity? And what is the attribute? – aQ123 Dec 07 '17 at 16:37
-
When I said manually I meant in code not in json. There's not support in jhipster for this – Gaël Marziou Dec 07 '17 at 16:52
-
I've added the read-only entity manually in the code as you suggested. Is it possible to include it in the jdl model? – aQ123 Dec 16 '17 at 01:30
-
No as I said before. – Gaël Marziou Dec 16 '17 at 13:50