0

It would be great if I could do something like (it's just an example):

@Entity
public class MyEntity {
   @Id 
   public String id;

   @Column(wrapInto = "UUID_GENERATE_V3(@Id)")
   public String uuid;
}

So JPA would magically wrap this into the field when translating into the underlying query. It is really useful for substrings, custom extensions... so I feel like it must exist a mechanism

Whimusical
  • 6,401
  • 11
  • 62
  • 105
  • [How to implement a JPA Attribute Converter](https://www.thoughts-on-java.org/jpa-21-how-to-implement-type-converter/), [Automatically convert a parameter with Spring Data JPA](https://stackoverflow.com/a/30399046/5380322) – Cepr0 Aug 30 '17 at 12:46
  • ``@Column(columnDefinition="your value")`` – Donald Wu Aug 30 '17 at 12:48
  • Is columnDefinition useful for reading or just for writing? I mean is columnDefinition="VARCHAR DEFAULT UUID_GENERATE_V3(id)" going to work when loading the entity as a virtual field? – Whimusical Aug 30 '17 at 13:08
  • @Cepr0 Converters are meant to be used for doing the conversion in Java – Whimusical Aug 30 '17 at 13:23

0 Answers0