Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9185221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:14:01+00:00 2026-06-17T19:14:01+00:00

I have a question in Hibernate annotations. I have an Entity, in that I

  • 0

I have a question in Hibernate annotations. I have an Entity, in that I have an column and I am using @JsonSerialize to converter the value to a different formate and using the @JsonProperty I am writing it to a different field in the output json:

@Transient
@Type(type = "org.hibernatespatial.GeometryUserType")
@Column(name = "the_geom", columnDefinition = "Geometry")
Geometry gml;

@JsonProperty("wkt")
@JsonSerialize(using = JsonGeometrySerializer.class)
public Geometry getGeom() {
    return geom;
}

public void setGeom(Geometry geom) {
    this.geom = geom;
}

Now I want to create a different property like @JsonProperty(“gml”) for the same geometry coming from the the_geom column and write it to a different field in the output json. Is there a way I can specify multiple values in the @JsonProperty? I tried creating another variable with getter/setters and use @Trancient but not sure how to send the the_geom value to that serializer. Please help.

I tried something like this and did not work:

    @Transient
@Type(type = "org.hibernatespatial.GeometryUserType")
@Column(name = "the_geom", columnDefinition = "Geometry")
Geometry gml;

@JsonSerialize(using = JsonGeometrySerializer.class)
public Geometry getGml() {
    return gml;
}

public void setGml(Geometry gml) {
    this.gml = gml;
}

SO in the first case the Geometry should be converted to wkt and added to the json and in the second the geometry should be converted to the GML format and added to the gml. Can I have the same JsonSerializer class to do both or do I have to write a new one?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:14:02+00:00Added an answer on June 17, 2026 at 7:14 pm

    Since you are attaching the @JsonSerializer to the method, whats stopping you from creating another getXXX method returning whatever you want, including the same value?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about how Hibernate persists entity relations. Let's say I have
I have a design question about the use of Hibernate annotations and DAO pattern.
I'm using JPA annotations only and hibernate 4.0.1 as the JPA implementation. I have
I have a simple question about usage of Hibernate. I keep seeing people using
I'm new to Hibernate. I'm using Hibernate 4.0 and specifically JPA annotations. I have
I am using Hibernate as JPA provider. I have for example this class: @Question(multipleChoiceQuestion)
I have a question about Hibernate ManyToOne association. I have a Product entity mapped
Ok, I have an entity class with a List member that maps through Hibernate
I have a hibernate question. My table is of the form: Id, Date --
I have what may be a pretty elementary Hibernate question. Do HQL (and/or Criteria)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.