db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charlie Kelly <Char...@CharlieKelly.com>
Subject Re: configuration derby plugin for eclipse
Date Thu, 19 Mar 2009 17:42:37 GMT
Hi Fernando,

I use Eclipse with Derby and Hibernate.

I find it helpful to create a project that has all the jar files needed 
by Derby, Eclipse, and other programs (for example, Velocity).
You can use Eclipse's wizard to create a plugin from existing jar 
archives (File->New->Project->Plugin Development->Plugin from existing 
jar archives).

You can create a properties file and folder in your plugin and access it 
with code that is similar to the following:

            hibernatePropertiesPlugin = 
MetaPersistenceActivator.getDefault();
            String propertiesFileNameFQ = "properties/hibernate.properties";
           
            Path hibernatePropertiesPath = new Path(propertiesFileNameFQ);
            Bundle hibernatePropertiesBundle = 
hibernatePropertiesPlugin.getBundle();
           
            URL hibernatePropertiesURL  = FileLocator.find 
(hibernatePropertiesBundle, hibernatePropertiesPath, null);
            if (null == hibernatePropertiesURL)
                throw new Exception ("URL is null for: " + 
propertiesFileNameFQ);

            boolean substituteArgumentsFlag = false;
            InputStream hibernatePropertiesInputStream = 
FileLocator.openStream(hibernatePropertiesBundle, 
hibernatePropertiesPath, substituteArgumentsFlag);
            int availableBytes = hibernatePropertiesInputStream.available();
            if (availableBytes <= 0)
                throw new Exception ("nothing available from 
properties/hibernate.properties");           
           
            hibernateProperties.load(hibernatePropertiesInputStream);

Use the name of the Activator for your plugin instead of 
"MetaPersitenceActivator"
"Path" is contained in org.eclipse.core.resources (which you must 
include as a dependency for your plugin).

Hope this helps.

Charlie

Fernando Freitas wrote:
> Hi People,
>
> sorry to repeat the question
> but, I forgot a detail, 
>
> I am eclipse user and I am using the derby like plugin (bundle).
>
> So , I don't know where the files was created.
>
> Can you help me?
>
> In this case (derby plugin for eclipse)
>
> 1) How could I use some file xml or another configuration file 
> configure the database, like to choose the place that I will create my 
> Database's instance.
>
> 2) Where Derby save your files of database.?
>
> Thanks and Best Regards
> Fernando 

Mime
View raw message