I didn't get constructor delegation part of your post, could you please 
suggest how can I modify my existing code (a sample would be really 
helpful). Thank you!

On Monday, July 8, 2013 10:24:29 AM UTC-5, Christoph Läubrich wrote:
>
>  Init a *PUBLIC* *STATIC* field via an instances constructor without any 
> syncronization can't be called bad style anymore... is a call for trouble!
>
> (btw your defaultconstructor shoudl really use constructor delegation ...)
>
> Am 08.07.2013 16:20, schrieb Fiendfyre: 
>
> This is my class definition  
>
>  public class Database
> {
>  public static JdbcConnectionPool poolMgr;
>  private final String autoMixedMode = ";AUTO_SERVER=TRUE"; // Enables
>  // Automatic
>  // Mixed Mode
>  // for Database
>
>  public Database() throws SQLException
>  {
>  new Database("/data/test", 100);
>  System.out.println("object >>> " + Database.this);
>  }
>
>  public Database(String path, int noOfCon) throws SQLException
>  {
>  poolMgr = JdbcConnectionPool.create("jdbc:h2:" + path + autoMixedMode, 
> "sa", ""); // Creates
>  // Connection
>  // Pool
>
>  System.out.println("In constructor");
>  poolMgr.setMaxConnections(noOfCon);
>  System.out.println("poolMgr ::: " + poolMgr);
>
>  }
>
>  public Connection getDbConnection() throws SQLException
>  {
>  return poolMgr.getConnection();
>  }
>
>  
>  
> On Monday, July 8, 2013 3:03:18 AM UTC-5, Noel Grandin wrote: 
>>
>> Probably because your code is instantiating your 
>> com.atr.media.db.Database object via the default constructor, which does 
>> not initialise the poolMgr field? 
>>
>> On 2013-07-07 21:40, Fiendfyre wrote: 
>> > I'm trying to implement H2 database auto mixed mode using JSF 2.1 with 
>> > Primefaces 4.0 and Primefaces Mobile 0.9.5. I have a session scoped 
>> > managed bean UserBean.java which has a managed property of application 
>> > scoped managed bean with lazy initialization(eager = true) 
>> > Database.java. I'm trying to get a connection pool with 100 
>> > connections up and running. I tried checking the object instance of 
>> > Database class and I get the reference of object correctly but the 
>> > instance variable poolMgr is returned null. can some one help me in 
>> > resolving this issue? 
>> > 
>>
>>  -- 
> You received this message because you are subscribed to the Google Groups 
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]<javascript:>
> .
> Visit this group at http://groups.google.com/group/h2-database.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>
> 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to