Announcement Announcement Module
Collapse
No announcement yet.
Automatic exception translation for Roo-style Entity classes? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Automatic exception translation for Roo-style Entity classes?

    Hi,

    I find the non-anemic entity model (that Roo generates by default via aspectj) very nice and simple. The one feature I miss from a repository-based approach, however, is the automatic translation of exceptions to the Spring dao exception hierarchy (using the appropriate bean post processor).

    How do I go about enabling automatic exception translation with Roo-generated entities? Or do I simply have to type it in (via EntityManagerFactoryUtils) myself for each entity persistence method? =)

    Cheers,
    Jukka

  • #2
    Hi Jukka,

    This is an interesting point. We find there are users who want to leverage Spring's exception translation mechanisms and others who don't. But there is no reason why it should not be available for those who want to use it. So the easiest is to create a new command or amend a current (JPA-related) command to enable this feature.

    The easiest way to support this would be if Roo would provide a small aspect which catches any RuntimeExceptions thrown by the JPA EntityManager and attempt to translate it accordingly.

    I have raised a Jira ticket for this so you can track the work on it or even comment if you wish: ROO-182

    -Stefan

    Comment


    • #3
      Thanks, I'll track ROO-182's development.

      Comment


      • #4
        I also tracked the roo-182 because i have a problem that when the there is no record to return, roo shows error in entitymanager.getSingleResult(); After i read in roo-182, i try to use command roo> install jpa exception -package ~.domain but in Roo 1.0.0 RC4 doesn't have this command. How should i do?

        Comment


        • #5
          Here's a link to ROO-182 for everyone's convenience.

          Comment


          • #6
            ROO-182 says that this is implemented, but I can't find any docs that tell me how to disable exception translation in my entitites (or methods, if they must be on the entity for Roo to work). How do I go about this?

            Comment

            Working...
            X