Deal of the Day

Home » Main » Manning Forums » 2010 » Spring Roo in Action

Thread: Using repository layer and reverse engineering. Possible?

Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Pages: 1 - Last Post: Aug 3, 2012 11:24 AM by: ken.rimple Threads: [ Previous | Next ]
gregsoulsby

Posts: 30
From: United Kingdom
Registered: 5/30/12
Using repository layer and reverse engineering. Possible?
Posted: Jul 10, 2012 2:36 AM
  Click to reply to this thread Reply

I would like to use the QueryDSL functions in Spring Data.

That means creating the repository layer in Roo with this command

repository jpa --interface ~.domain.CfxAddress --entity ~.domain.CfxAddress

Should the name ~.domain.CfxAddress be the same as that that you get from reverse engineering, and thus overwriting the active record created from reverse engineering? Or should you use another name and thus keep them both?

(I tried using the same name, but that wrecked the --testAutomatically tests from reverse engineering. I tried using different but could not get QueryDSL to run as it classed with the no repository domain classed.)

ken.rimple


Posts: 250
From: Philadelphia, PA
Registered: 7/10/10
Re: Using repository layer and reverse engineering. Possible?
Posted: Jul 23, 2012 5:30 AM   in response to: gregsoulsby in response to: gregsoulsby
  Click to reply to this thread Reply

Greg,

I've been away from the forums as my day-work has become my night-work for the time being.

Assuming you are following this procedure:

http://blog.springsource.org/2011/04/26/advanced-spring-data-jpa-specifications-and-querydsl/

Do you have any code snippets or exception messages you can share? It looks like if you extend the QueryDSL interface QueryDslPredicateExecutor you should get the ability to create the BooleanExpression statements that you can then chain into calls to your Repository's findAll method.

If you have it going, I'm curious what you think of it. Seems easier than CriteriaBuilder queries to me and much more fluent.

Ken

ken.rimple


Posts: 250
From: Philadelphia, PA
Registered: 7/10/10
Re: Using repository layer and reverse engineering. Possible?
Posted: Jul 23, 2012 11:02 PM   in response to: ken.rimple in response to: ken.rimple
  Click to reply to this thread Reply

Putting the DBRE aside for the moment, I had trouble getting anything to work on the QueryDSL generators with the pre-built ITDs. Since the actual class doesn't have an @Entity on it (until the AspectJ compiler comes in and adds it) when the QueryDSL is generating code, it doesn't see them as entities.

I push-in refactored one of my entities and it worked - found the entity and build the Q class for it in generated-sources.

gregsoulsby

Posts: 30
From: United Kingdom
Registered: 5/30/12
Re: Using repository layer and reverse engineering. Possible?
Posted: Aug 3, 2012 7:15 AM   in response to: ken.rimple in response to: ken.rimple
  Click to reply to this thread Reply

That makes sense, even if I dont like it.

In the Spring Roo addins webinar this week you mentioned the developers are putting a lot of effort at the moment into something, which supported a DSL. I heard it as Scala?

So would that be an option instead of QueryDSL?

If so I think I will wait.

ken.rimple


Posts: 250
From: Philadelphia, PA
Registered: 7/10/10
Re: Using repository layer and reverse engineering. Possible?
Posted: Aug 3, 2012 11:24 AM   in response to: gregsoulsby in response to: gregsoulsby
  Click to reply to this thread Reply

The topic I was referring to was the Spring Integration team working on a Scala DSL. Kind of like JavaConfig but with Scala syntax and specifically for setting up S/I configurations.

Ken

Legend
Gold: 300 + pts
Silver: 100 - 299 pts
Bronze: 25 - 99 pts
Manning Author
Manning Staff
Manning Developmental Editor