Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Combining Active Object entities with JAXB annotations, any implementation examples?

Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 4, 2011

I think it ought to be possible to use Jaxb annotations on specific AO interface getters in order to serialise AO enties as XML in a REST response. But Im having some issues with generation:

Entity xxxxx has no primary key field

at net.java.ao.Common.getPrimaryKeyClassType(Common.java:291)

at net.java.ao.Common.getPrimaryKeyType(Common.java:283)

Failing this I guess Id have to populate specific entities for JAXB serialization but having two model structures seems a pain.

6 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 19, 2014

You dont, you have to propogate your fields into the AO entity via your AOService, which can be constructor injected into your rest service?

0 votes
pelizza
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 3, 2014

I've found this documentation explaining how to annotate interfaces to use with JAXB: https://jaxb.java.net/guide/Mapping_interfaces.html#Use__XmlJavaTypeAdapter

Anyway, what can I do with an active objects' entity on my rest API? How to persist it if it does not have any entity manager injected and are out of persistence context? :(

0 votes
pelizza
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 3, 2014

Hi guys,

Any movement with this issue? I'm facing same problem... :/ For now, I've separated my entity from "beans" to be serialized though REST API, what is not even close to a nice solution...

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 15, 2013

Cheers Andy. I had the same idea, but didn't quite get the hierarchy straight in my mind, although it seems simple enough. What I tried didn't work anyway. When I get back to this I will give it another go.

0 votes
Andy Brook [another me] July 11, 2013

Hi Jamie, yea, I have the same issue for REST and AO data also.

Have you tried splitting the accessors into a MOdel interface not extending Entity, with accessor annotations, then, have your ActiveObject interface use multiple inheritence for both Entity and the Model interface? Ive done this in a limited way for my purposes, not gone the whole way. I wonder what happens if you push a cast reference to the Model into JAXB? Let me know :)

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 11, 2013

Andy - let me know if you got anywhere with this - I am having the same/similar issue: https://answers.atlassian.com/questions/189298/simple-crud-rest-api-for-active-objects-tables

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events