[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jboss-user
Subject:    RE: [JBoss-user] CMR uses the default datasource in stead of the one specifically specified for the
From:       Allan Kamau <hugebirdwings () yahoo ! com>
Date:       2003-03-31 14:12:31
[Download RAW message or body]

Hi,
I faced the same problem some time back and this is
how I solved it (on JBoss 3.0.6).
My application was using data from PostgreSQL database
and I had to access use data residing a M$ SQL 2000
database.
I had configured the entire application to use
PostgreSQL for CMP persistence. I did this by creating
a “META-INF/jbosscmp-jdbc.xml” containing something
like this.
<jbosscmp-jdbc>
    <defaults>
        <datasource>java:/PostgresDS</datasource>
		<datasource-mapping>PostgreSQL
7.2</datasource-mapping>
		<create-table>true</create-table>
		<remove-table>false</remove-table>
		<read-only>false</read-only>
		<time-out>300</time-out>
		<pk-constraint>true</pk-constraint>
		<fk-constraint>true</fk-constraint>
		<row-locking>false</row-locking>
	
<preferred-relation-mapping>foreign-key</preferred-relation-mapping>
		<read-ahead>
		<strategy>on-load</strategy>
		<page-size>1000</page-size>
		<eager-load-group>*</eager-load-group>
		</read-ahead>
		<list-cache-max>1000</list-cache-max>
 
    </defaults>
    <enterprise-beans>
    	<entity>
    	
<ejb-name>PBudgetSummaryLineItemYearEJB</ejb-name>
    		<datasource>java:/MSSQLDS</datasource>
    		<datasource-mapping>MS
SQLSERVER2000</datasource-mapping>
    	
<table-name>PBudgetSummaryLineItemYearEJB</table-name>
    		<create-table>true</create-table>
    	</entity>
    </enterprise-beans>
</jbosscmp-jdbc>


Now all the CMP entity beans in my application are
using the PostgreSQL datasource. EXCEPT the
“PBudgetSummaryLineItemYearEJB” CMP entity bean which
is using MSSQLDS datasource for persistence.

Of course the datasources have to be configured in
your JBoss installation. 


Allan Kamau.




--- Jboss Percy <jbosspercy@hotmail.com> wrote:
> I use the normal download (with Tomcat integrated)
> from the Jboss Site
> jboss-3.0.6_tomcat-4.1.18.
> Here is the release log.
> JBoss Release: JBoss-3.0.6 CVSTag=JBoss_3_0_6
> How and where can I get that latewst release? Is
> that build or do I have
> to retrieve the sources and build 
> My own version from a merge?
> 
> 
> -----Original Message-----
> From: jboss-user-admin@lists.sourceforge.net
> [mailto:jboss-user-admin@lists.sourceforge.net] On
> Behalf Of Alex
> Loubyansky
> Sent: maandag 31 maart 2003 13:40
> To: Jboss Percy
> Subject: Re: [JBoss-user] CMR uses the default
> datasource in stead of
> the one specifically specified for the CMP 2.0 EJB
> entity beans
> concerned
> 
> 
> What JBoss version are you using?
> This was fixed in Branch_3_2 recently.
> 
> alex
> 
> Monday, March 31, 2003, 2:05:25 PM, Jboss Percy
> wrote:
> 
> JP> I am new to JBoss and to MySql (although the
> problem has not 
> JP> specifically to do with MySql). I am trying to
> port a rather large 
> JP> application from Borland BES 5.2 to JBoss 3.06
> and ran in a little 
> JP> problem. The application uses different
> databases, which I all 
> JP> hosted to MySql. Each deployable unit has its
> own database with its 
> JP> own tables. This situation prevents me from
> using the simple 
> JP> solution of setting a single database a default
> data source (in the
> JP>
>
<JbossInstallDir>\server\default\conf\standardjaws.xml
> and 
> JP>
>
<JbossInstallDir>\server\default\conf\standardjbosscmp-jdbc.xml)
> 
> JP> So I define my multiple data sources in multiple
> mysql-xxxx-service.xml
> JP> files (one per database) and configure each of
> these services in the
> JP>
>
<JbossInstallDir>\server\default\conf\login-config.xml)
> 
> JP> All runs fine except for the CMR. When I create
> a new (EJB 2.0 
> JP> entity
> JP> bean) relation I see that the Hypersonic SQL
> driver is selected
> in-stead
> JP> of the MySql one, although I specifically
> specified the datasource
> JP> element of EJB 2.0 CMP each entity bean. On top
> I cannot specify the
> JP> <datasource> element in the relation (It is
> specified in the
> <entity>
> JP> element although but that seems to be ignored in
> the relationship
> JP> elements that uses these entities). Both
> entities that are parts of
> the
> JP> relation are in the same datasource (read
> database).
> JP> I can of course also include a <defaults>
> element in the
> JP> jbosscmp-jdbc.xml file in the deployed unit but
> there again that
> would
> JP> be for the whole deployable unit (which could
> contain may different
> JP> entity beans which would not necessarily all use
> the same datastore.
> My
> JP> guess is that the relationships should
> automatically inherit
> whatever
> JP> datastore specification the entity bean to which
> the relationship
> JP> belongs has. This seems logic as I cannot
> understand where the data
> JP> should be stored elsewhere as in the same
> database as the rest of
> the
> JP> data of the bean.
> 
> JP> Has anyone an Idea of how to overcome this
> problem.
> 
> JP> Thanks for any advance.
> 
> JP> Percy Christian
> 
> JP> jbosspercy@hotmail.com
> 
> 
> 
> 
>
-------------------------------------------------------
> This SF.net email is sponsored by: ValueWeb: 
> Dedicated Hosting for just $79/mo with 500 GB of
> bandwidth! 
> No other company gives more support or power for
> your dedicated server
>
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
> _______________________________________________
> JBoss-user mailing list
> JBoss-user@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
>
-------------------------------------------------------
> This SF.net email is sponsored by: ValueWeb: 
> Dedicated Hosting for just $79/mo with 500 GB of
> bandwidth! 
> No other company gives more support or power for
> your dedicated server
>
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
> _______________________________________________
> JBoss-user mailing list
> JBoss-user@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/jboss-user


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com


-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic