You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by bogdan_voloshincu <bo...@yahoo.com> on 2010/11/21 07:11:17 UTC

pls helppppp !!! cayenne.xml

i hava the next problem : how can i reload or refresh my cayenne.xml after i
add or remove one or more domanis. how can i read cayanne.xml at runtime if
it's posible ? if not can somebody give another example pls thank you!
-- 
View this message in context: http://cayenne.195.n3.nabble.com/pls-helppppp-cayenne-xml-tp1939034p1939034.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Re: pls helppppp !!! cayenne.xml

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hmm, your question was about refreshing Configuration loaded from cayenne.xml. Looking at your second message, I am no longer sure that I understood your setup and what you are trying to do. 

But in any event... 'DataContext.createDataContext' uses shared static Configuration (You may take a look at the source code to see what I am talking about). If you need to refresh it (regardless of the configuration source), this is your starting point. 

Andrus


On Nov 21, 2010, at 2:18 PM, bogdan_voloshincu wrote:
> Thank you Andrus but for me  it doesn't   work   and i think is because when
> the application run  Cayenne loads the informations from resources at start
> up. i have see that i can setup domains this way : 
> 
> ---------------------------------------------------------------------
> 
> DataSource dataSource = new PoolManager("org.postgresql.Driver",
> "jdbc:postgresql://localhost:5432/postgres", 1,4,"postgres","root");
>                                        DataNode dn = new DataNode();
> 				         dn.setDataSource(dataSource);
> 
> 					 DataMap dm = new DataMap();
> 					 dm.setDefaultSchema("public");
> 					 dm.setDefaultPackage("psql");
> 					 
>                                        DataDomain dd = new
> DataDomain("Ab");
> 					 dd.addMap(dm);
>                                        dd.addNode(dn);
> 
> 
>                                       conf.addDomain(dd);
> 					
> 					
> -----------------------------------------------------------
> 
> 
> but when i pass the domain name to :
> 
> ObjectContext ov = DataContext.createDataContext(Domain Name);   it doesn't
> show anything not even a error message .
> -- 
> View this message in context: http://cayenne.195.n3.nabble.com/pls-helppppp-cayenne-xml-tp1939034p1939853.html
> Sent from the Cayenne - User mailing list archive at Nabble.com.
> 


Re: pls helppppp !!! cayenne.xml

Posted by bogdan_voloshincu <bo...@yahoo.com>.
Thank you Andrus but for me  it doesn't   work   and i think is because when
the application run  Cayenne loads the informations from resources at start
up. i have see that i can setup domains this way : 

---------------------------------------------------------------------

DataSource dataSource = new PoolManager("org.postgresql.Driver",
"jdbc:postgresql://localhost:5432/postgres", 1,4,"postgres","root");
                                         DataNode dn = new DataNode();
				         dn.setDataSource(dataSource);
                                        
					 DataMap dm = new DataMap();
					 dm.setDefaultSchema("public");
					 dm.setDefaultPackage("psql");
					 
                                         DataDomain dd = new
DataDomain("Ab");
					 dd.addMap(dm);
                                         dd.addNode(dn);
                                           

                                        conf.addDomain(dd);
					
					
-----------------------------------------------------------


but when i pass the domain name to :

ObjectContext ov = DataContext.createDataContext(Domain Name);   it doesn't
show anything not even a error message .
-- 
View this message in context: http://cayenne.195.n3.nabble.com/pls-helppppp-cayenne-xml-tp1939034p1939853.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Re: pls helppppp !!! cayenne.xml

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Nov 21, 2010, at 8:11 AM, bogdan_voloshincu wrote:

> 
> i hava the next problem : how can i reload or refresh my cayenne.xml after i
> add or remove one or more domanis. how can i read cayanne.xml at runtime if
> it's posible ? if not can somebody give another example pls thank you!

Assuming you are using shared configuration:

  Configuration.getSharedConfiguration().shutdown();
  Configuration.initializeSharedConfiguration();

Andrus