You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Zigs Torque <zi...@yahoo.com> on 2003/08/27 03:29:17 UTC

Torque: Hard coding of database name in *BasePeer and *MapBuilder java files.

 Hi All,
 
 Whoever solve my problem, I would really appreciate.
 Im using TORQUE 3.0 , and we have database name hard
 coded when we run torque to generate beans .. hard
 coding in *BasePeer.java and *MapBuilder.java files 
   Is this issue already bean addressed or any
 alternatives to get away from this hard coding , so
 that we can have database name reading from some
 property or xml file directly run time.
 
 Thanks a lot, appreciate any help.

-zt

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: Torque: Hard coding of database name in *BasePeer and *MapBuilder java files.

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Zigs Torque <zi...@yahoo.com> writes:

No, you don't. You have the data source names hard coded in your peers.
The actual database is controlled by the DB URI, that you specify in your
torque.properties.

	Regards
		Henning


> Hi All,
> 
> Whoever solve my problem, I would really appreciate.
> Im using TORQUE 3.0 , and we have database name hard
> coded when we run torque to generate beans .. hard
> coding in *BasePeer.java and *MapBuilder.java files 
>   Is this issue already bean addressed or any
> alternatives to get away from this hard coding , so
> that we can have database name reading from some
> property or xml file directly run time.
> 
> Thanks a lot, appreciate any help.

>-zt

>__________________________________
>Do you Yahoo!?
>Yahoo! SiteBuilder - Free, easy-to-use web site design software
>http://sitebuilder.yahoo.com

>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-dev-help@db.apache.org

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"Dominate!! Dominate!! Eat your young and aggregate! I have grotty silicon!" 
      -- AOL CD when played backwards  (User Friendly - 200-10-15)

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Re: Torque: Hard coding of database name in *BasePeer and *MapBuilder java files.

Posted by CP Lim <cp...@redsheriff.com>.
Hi Zigs,

The database name in the *BasePeer.java and *MapBuilder.java are really 
just labels used in the Torque.properties file.  eg.  given the 
following *MapBuilder.java file:

---------------
// SomeClassMapBuilder.java
     public void doBuild() throws TorqueException
     {
         dbMap = Torque.getDatabaseMap("cpl"); // LABEL = 'cpl'
	
	// more code to follow...
----------------

The 'cpl' label really maps to the 'torque.database.default' parameter 
in the Torque.properties file:

----------------
# The default database config to use.
torque.database.default=cpl
torque.database.cpl.adapter=postgresql
----------------

Hope that helps.

cheers,
CP


Zigs Torque wrote:

>  Hi All,
>  
>  Whoever solve my problem, I would really appreciate.
>  Im using TORQUE 3.0 , and we have database name hard
>  coded when we run torque to generate beans .. hard
>  coding in *BasePeer.java and *MapBuilder.java files 
>    Is this issue already bean addressed or any
>  alternatives to get away from this hard coding , so
>  that we can have database name reading from some
>  property or xml file directly run time.
>  
>  Thanks a lot, appreciate any help.
> 
> -zt
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
> 
> 
> 

-- 
R E D S H E R I F F
C.P. Lim - Software Engineer
[cp_lim@redsheriff.com]

96-98 Market St    +61 (3) 9606 4036 tel
South Melbourne    +61 (3) 9606 4001 fax
Victoria  3205     +61 (413) 781 846 cell

This message and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they are 
addressed. If you are not the intended recipient, you are hereby 
notified that any use or dissemination of this communication is strictly 
prohibited. If you have received this message in error please notify us 
immediately by return email or telephone +61 (2) 8204 5888, then delete 
this message. Any views expressed in this message are those of the 
individual sender and many not necessarily reflect the views of Red 
Sheriff.


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org