Domain model and DTO

I have found a nice project about taking snapshots out of model and puttin this on DTOs (XSnapshot). As in my current project we have lots of DTOs I’ve jumped on board and try it. I am generating the domain model classes from Hibernate mapping files. I have found a way to include in the generated files the javadoc tags required by XSnapshot (by using the <meta> element 😉 ) and then I fired the XSnapshot Ant task. Wow! I got my first DTO directly from domain model objects without having to write a single line of code. Nice!
Now the second step. I have some DTOs which are made up from properties fetched from different domain model objects. Oke, let’s get these generated too. Taking a fast look at available tags I have found that @xsnapshot.property has a match attribute which can have as a value a list of comma separeted DTO names. Fine, so it might work… but surprise… it isn’t :-(.
I jumped to the sources and after some digging I saw something strange (for me, at least). I thought that for being able to have the a/m scenario working the guys should use some kind of repository before generating the code, but they haven’t. So there is no possible solution.
I’ve started the mail and asked a question to the dev guys. Only after a few hours I got the solution from the guys: if I want my scenario to work I should do some coding. Yakkk!
XSnapshot supports the generation of DTOs by initial domain model object. So if I want to gather info from more than one domain model object I should write down a class to include the generated DTOs. Why, oh why?

I think I will start my own version of xsnapshot – forked. (to be continued)

Advertisements

Leave a comment

Filed under personalog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s