Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
486 views
in Technique[技术] by (71.8m points)

postgresql - TomEE / OpenJPA persistence + Postgress UUID Field

I am trying to map a Postgresql UUID column, to Java UUID field, using OpenJPA (included with TomEE microprofile). After doing a fair amount of google searching, I think it's due to postgres supplying the UUID as a Blob. OpenJPA is throwing a "Caused by: java.io.StreamCorruptedException: invalid stream header:" error, when the UUID field is populated.

One solution I have tried (below), doesn't work. Maybe I need some kind of field converter, but I do not know how make one in a standards compatible way? I also tried making a String to UUID converter, but this wasn't even being called.

Thanks.

@Entity
public class Fs_players {
    
    @Id
    public int userid;
    public String profile_name;
    public String infotxt;
    
    @Column(columnDefinition = "uuid", updatable = false )
    private UUID profile_pic;
    
    public long stock_price;
    public long cash;
    public long credits;
    public Date proexpiry;

...
question from:https://stackoverflow.com/questions/65641213/tomee-openjpa-persistence-postgress-uuid-field

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...