Answer the question
In order to leave comments, you need to log in
How to implement Enums in java Spring JPA?
Good evening everyone. Help please, I can not implement the use of enumeration as a field of an object. An object can only have one enum value.
Now I'm doing through the collection:
@ElementCollection(targetClass = Quality.class, fetch = FetchType.EAGER)
@CollectionTable(name = "quality", joinColumns = @JoinColumn(name = "realty_id"))
@Enumerated(EnumType.STRING)
private Set<Quality> quality;
@Column(name = "quality", nullable = false, unique = false)
@Enumerated(EnumType.STRING)
private Quality quality;
<html>
<body>
<div>Список объектов</div>
<span><a href="newobj">Создать объект</a></span>
<div>
<form method="post">
<input type="number" name="price1" placeholder="цена от" value=0>
<input type="number" name="price2" placeholder="цена до" value=0>
<button type="submit">Применить фильтр</button>
</form>
{{#realties}}
<div>
<b>{{id}}</b>
<b>{{description}}</b>
<b>{{price}}</b>
<b>{{quality}}</b>
</div>
{{/realties}}
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question