Casper Bang wrote:
> The issue goes a little deeper than your simple use case though. The
> Java enterprise world, due to the lack of expression trees, has to
> work with many thousands lines of embedded DSL (JPQL/HQL/SQL etc.).
> This poses several problems:
>
> - How do you format/indent it?
> - How do you copy-paste between database tool and IDE?
> - How do you get help with the syntax?
>
> By my experience, that is very much a real problem :
>
> " select new com.somecompany.somexp.backend.model.ManagerInfoRecord("+
> "     c, b.itemNo, x )" +
> " from SomeEntity x" +
> " Join x.account a" +
> " Join a.baseData b" +
> " Join b.customer c "+
> " where x.state <> com.somecompany.somexp.backend.entities.SomeEntity
> $ReadingState.InValid " +
> " and (  " +
> "    (" +
> "      x.someState = com.somecompany.somexp.backend.entities.SomeEntity
> $someState.Valid " +
> "      and b.someData <> 'Y' " +
> "    )" +
> "    or  x.someOtherState =
> com.somecompany.somexp.backend.entities.SomeEntity
> $someOtherState.Valid  " +
> " )" +
> " and b.relatedEntity =:relatedEntity " +
> " and x.someForeignRelation <>
> com.somecompany.somexp.backend.entities.SomeEntity$EntityStateEnum.E
> "  ),
>
> And that's just one small annotation query (obfuscated to protect the
> innocent). Fun eh? :)
>   
You don't embed this sort of thing.  You use getResourceAsStream() and a 
separate file along with MessageFormat or such to perform substitutions 
of live data if need be.

Plain and simple.

This also allows the IDE to do easily appropriate things for a .sql file 
or the like.

[In the XML sphere I'm all for sticking SVG, XSL FO, etc, directly 
inside an XHTML document -- but this whole approach seems to be dying on 
the vine there, even though the grammar is the same throughout all of 
these.]

--
Jess Holle


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javaposse@googlegroups.com
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to