8

I have an object in java that have a lot of properties. I want to get it for create a SOAP request dynamically (tags-value).

I need all of this properties not only the first level (I want properties inside others properties).

I see the reflection api in java in this web but only give me the public properties (or declared with getDeclaredFields()) of the object and I have properties in other classes because hibernate get me all values from a DB in FetchType.EAGER

@Version @Column(name = "VERSION") private Integer version; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "ID_LUGAR") public GatLugar gatLugar; @Column(name = "NUM_ATESTADO") public Long numAtestado; @Temporal(TemporalType.DATE) @Column(name = "FECHA_REGISTRO") private Date fechaRegistro; @Temporal(TemporalType.DATE) @Column(name = "FECHA_HECHO") private Date fechaHecho; 

For example numAtestado with java reflection get it but gatLugar have more properties-values inside and dont have it with reflection.

Sorry for my english im from spain xD

Thanks for all!!

1

1 Answer 1

18

You can use:

<YOUR CLASS>.getClass().getDeclaredFields() 

And then also use: getDeclaredFields() for the field you got above

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.