• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EnterpriseObjects in a regular Java application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EnterpriseObjects in a regular Java application


  • Subject: Re: EnterpriseObjects in a regular Java application
  • From: "John Huss" <email@hidden>
  • Date: Mon, 30 Jan 2006 17:00:28 -0600

Calling  EOModelGroup.defaultGroup()  causes the exception I listed below.  So apparently I'm missing something.
 
John
 
----- Original Message -----
From: Mike Schrag
To: John Huss
Cc: Ruenagel, Frank ; email@hidden
Sent: Monday, January 30, 2006 3:56 PM
Subject: Re: EnterpriseObjects in a regular Java application

It's a lot easier than that .. Here's a little bit of sample code from a test main method I have:

  public static void main(String[] args) throws MalformedURLException {
    EOModelGroup.defaultGroup().addModelWithPathURL(new File("MyEOModel.eomodeld").toURL());
    EOEditingContext ec = new EOEditingContext();
    TestEntity te = ...;
    ec.saveChanges();
  }

classpath contains:
my source
frontbaseplugin.jar
javaeoaccess.jar
javaeocontrol.jar
javafoundation.jar
javajdbcadaptor.jar
javawebobjects.jar
javaxml.jar

ms

On Jan 30, 2006, at 4:46 PM, John Huss wrote:

I'm still having problems with this.  It seems to be having trouble loading Bundles or something.
 
I tried several different things.  The most promising has been the approach described here:

http://www.wodeveloper.com/omniLists/eof/2002/March/msg00018.html

My code looks like this (Import.java):
 
public static void main (String args[]) {
  try {
    JDBCAdaptor adaptor = new JDBCAdaptor("JavaJDBCAdaptor");
    EODatabase database = new EODatabase(adaptor);
    EODatabaseContext dbContext = new EODatabaseContext(database);
    EOObjectStoreCoordinator.defaultCoordinator().addCooperatingObjectStore(dbContext);
 
    //Using EOModelGroup.defaultGroup() caused an exception (same one reported below), so I created a new one instead.
    EOModelGroup modelGroup = new EOModelGroup();

    EOModel model = modelGroup.addModelWithPathURL( new File("MyModel.eomodeld").toURL() );
    adaptor.setConnectionDictionary(model.connectionDictionary());
    database.addModel(model);
 
    // this causes an exception
    modelGroup.loadAllModelObjects();
   
  } catch (java.net.MalformedURLException e) {
    e.printStackTrace();
  }
 
  .....
}
 
When I run it I get this exception:
 
Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.webobjects.eoaccess.EOAdaptor.infoDictionaryForAdaptorNamed(EOAdaptor.java:238)
        at com.webobjects.eoaccess.EOAdaptor.classNameForAdaptorNamed(EOAdaptor.java:254)
        at com.webobjects.eoaccess.EOAdaptor.classForAdaptorNamed(EOAdaptor.java:271)
        at com.webobjects.eoaccess.EOAdaptor.adaptorWithName(EOAdaptor.java:295)
        at com.webobjects.eoaccess.EOAdaptor.adaptorWithModel(EOAdaptor.java:325)
        at com.webobjects.eoaccess.EOModel.createPrototypeCache(EOModel.java:610)
        at com.webobjects.eoaccess.EOModel.prototypeAttributeNamed(EOModel.java:652)
        at com.webobjects.eoaccess.EOAttribute.<init>(EOAttribute.java:923)
        at com.webobjects.eoaccess.EOEntity.attributes(EOEntity.java:675)
        at com.webobjects.eoaccess.EOEntity._loadEntity(EOEntity.java:3704)
        at com.webobjects.eoaccess.EOModel.loadAllModelObjects(EOModel.java:1830)
        at com.webobjects.eoaccess.EOModelGroup.loadAllModelObjects(EOModelGroup.java:682)
        at SalondataComparisonImport.main(Import.java:23)
Caused by: java.lang.NullPointerException
        at com.webobjects.foundation.NSBundle.LoadUserAndBundleProperties(NSBundle.java:640)
        at com.webobjects.foundation.NSBundle.<clinit>(NSBundle.java:367)
        ... 13 more
 
 
I've included all the necessary jars I think: EOAccess, EOControl, JavaFoundation, JavaXML, JDBCAdaptor, FrontBasePlugIn
 
Any ideas are welcome.
 
Thanks!
John
 
 
----- Original Message -----
From: "Ruenagel, Frank" <email@hidden>
To: "John Huss" <email@hidden>
Cc: <email@hidden>
Sent: Monday, January 30, 2006 3:24 AM
Subject: RE: EnterpriseObjects in a regular Java application

> Hi,
>
> there is a little bit outdated stepwise article about this issue:
>
http://www.stepwise.com/Articles/Technical/2001-07-01.01.html
>
> It has helped me to create a java console app.
>
> HTH
> Frank
>
>
>> -----Original Message-----
>> From:
webobjects-dev-bounces+webobjects=email@hidden
>> [mailto:webobjects-dev-bounces+webobjects=symposion.de@lists.a
>> pple.com]O
>> n Behalf Of John Huss
>> Sent: Friday, January 27, 2006 9:35 PM
>> To:
email@hidden
>> Subject: EnterpriseObjects in a regular Java application
>>
>>
>> Is it possible to use my EnterpriseObjects classes and
>> EOModel in a regular
>> Java application without any web interface?
>>
>> How do I get a connection to the database and get an editing context?
>>
>> My ultimate goal is to write a little command-line program
>> that will import
>> text files into a database at scheduled times.  If this is a
>> bad approach
>> I'm open to other ideas.
>>
>> Thanks,
>> John
>>
>>  _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (
email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> email@hidden
>>
>> This email sent to
email@hidden
>>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >RE: EnterpriseObjects in a regular Java application (From: "Ruenagel, Frank" <email@hidden>)
 >Re: EnterpriseObjects in a regular Java application (From: "John Huss" <email@hidden>)
 >Re: EnterpriseObjects in a regular Java application (From: Mike Schrag <email@hidden>)

  • Prev by Date: Re: Easy question I hope
  • Next by Date: Re: EnterpriseObjects in a regular Java application
  • Previous by thread: Re: EnterpriseObjects in a regular Java application
  • Next by thread: Re: EnterpriseObjects in a regular Java application
  • Index(es):
    • Date
    • Thread