users
[Top] [All Lists]

Hibernate Annotation Autodiscovery and Autoconfiguration

To: CinJug <users@xxxxxxxxxx>
Subject: Hibernate Annotation Autodiscovery and Autoconfiguration
From: "Edward Sumerfield" <esumerfd@xxxxxxxxxxxxxx>
Date: Fri, 16 Nov 2007 08:35:15 -0500
Delivered-to: mailing list users@xxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:sender:to:subject:mime-version:content-type:x-google-sender-auth; bh=8b2puVQgSUgo48yMqOZl6oTs/C9YaBGtTqgtgzPO/kI=; b=e2xmbTRnSZGC235EHkiV9ZCabVkSsn94CY5ocQq8UQTNLIUpCx6htrN+6NowiGRjvCpHUFqqBTXRnHJ7o7i2tlBcJj+yr6tHDEMijNsUbxCGoszJi9I5gNLO4htbQIr0QOXq58HHGzU5mDXryCo527elVNWqPhlGln7lIgTZXKI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:sender:to:subject:mime-version:content-type:x-google-sender-auth; b=TpFBJfuPWO+ylxDpBCSBWXcvS8MjThgGEYBsejf4EEkwCxFZqKo+3RlHwRZlOIpMJ9FTtrUSQLqn60BtZ7hBy151ZW+MvonzN8nLtgIUn26pediRrYPw/UjC8N3FMB6XZLq3q6rx6qiybHt+h/kSqayQbceKXLz5P493/gwS//o=
Mailing-list: contact users-help@xxxxxxxxxx; run by ezmlm
Reply-to: esumerfd@xxxxxxxxxxxxxx
Sender: esumerfd@xxxxxxxxx
Two questions today:

1) I have hibernate 3 annotations buzzing along just fine all configured in Spring 2 but, being a lazy fellow, I don't want to have to add every entity into the Spring config file. Instead, I would like an autodiscovery mechanism to find the @Entity annotated classes and add them to Spring config automatically.

Before I go off an write such a thing perhaps someone knows of an existing solution.

        <property name="annotatedClasses">
            <list>
                <value>org.acme.entity.Customer </value>
            </list>
        </property>

2) I am using the HibernateDaoSupport class and so have two beans configured for every Dao that I write. Is there a simple way to condense the bean declarations needed to add a Dao? This is what I have at the moment for a single Dao and the only difference between Daos is the word "Acme", all the rest is vanilla template code.

Is there a simpler way than code generation?

    <bean
        id="acmeDaoTarget"
        class="org.acme.dao.AcmeDaoImpl"
        autowire="byName" />

    <bean
        id="org.acme.dao.AcmeDao"
        class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyInterfaces">
            <value> org.acme.dao.AcmeDao</value>
        </property>
        <property name="interceptorNames">
            <list>
                <value>hibernateInterceptor</value>
                <value>acmeDaoTarget</value>
            </list>
        </property>
    </bean>

--
Ed
<Prev in Thread] Current Thread [Next in Thread>