Re: SQL Server - Autoincrement Primary Keys

2000-11-14 Thread Shayne Hughes

I'd be interested to hear what others think of this method of using MSSQL's
autoincrement type as PK.  I have tried this and it seems to work in simple
tests.  Yeah it's not portable and probably breaks several rules.

For this table...
CREATE TABLE [dbo].[Lab] (
 [LabID] [int] IDENTITY (1, 1) NOT NULL ,
 [Name] [varchar] (255) NOT NULL ,
 [LastUpdate] [datetime] NOT NULL
)

I have an CMP EJB with the following in the orion-ejb-jar.xml...
   

 Lab
 findNew
 
  java.lang.String
 

   

So, you never create a new bean in the normal CMP way, but if you need a new
one, you call this finder which creates a new one and finds it.

Shayne


- Original Message -
From: "Sven van 't Veer" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Tuesday, November 14, 2000 10:21 AM
Subject: Re: SQL Server - Autoincrement Primary Keys


> Chris Miller wrote:
> >
> > Hi all,
> >
> > This is possibly more of a generic EJB question, although maybe not
since
> > Orion has to implement the persistence...
> >
> > I was wondering if it is possible to use CMP beans against an existing
> > SQL-Server database that has autoincrement primary keys. It's not
possible
> > to insert a value for the key (have to supply null), so using something
like
> > counter.jar to override the PK generation is not an option. Has anyone
done
> > this successfully? What's the trick, or am I stuck with BMP (as I
suspect is
> > the case)?
> >
> Using auto incrementing fields in EJB is not very usefull since they may
> map to databases not supporting such features, it's just like stored
> procedures. They might seem to look like a good idea, but it just makes
> the application much less portable.
>
> Orion includes an EJB which can generate a unique id for you, it's in
> counter.jar (I think you can find it in the news app).
>
> However if you really have to use an existing DB, you're either stuck
> with using BMP or you could write an entitybean (CMP) which only does
> the updates for you and may delete te bean by calling remove on the bean
> and a stateles session bean that handles the insertions for you.
>
> sven
>
> --
>

==
> Sven E. van 't Veer
> http://www.cachoeiro.net
> Java Developer [EMAIL PROTECTED]
>

==
>





Re: database connectivity

2000-08-31 Thread Shayne Hughes



I think you need to change the url line to add the 
port number...
 
url="jdbc:inetdae:localhost:1433?database=dBTest"
 
Shayne
 

  - Original Message - 
  From: 
  Derek Akers 
  To: Orion-Interest 
  Sent: Thursday, August 31, 2000 7:52 
  AM
  Subject: database connectivity
  
  I am having a problem connecting to a database for some 
  reason.  I am using MS SQL server 7 and have obtained the proper driver 
  (SPRINTA2000) and set up the ODBC data source, however Console has a problem 
  displaying the tables of the DB.  I have tried it this way and using the 
  generic JDBC:ODBC driver.  the two versions of data-sources I have tried 
  are attached.  With the generic driver, I have not found anywhere where 
  the data source's name is specified for connection, and with the SPRINTA2000 
  driver, I am having access problems still...  would anyone be willing to 
  walk me through this one?
   
     name="Default 
  data-source"  class="com.evermind.sql.ConnectionDataSource"  location="jdbc/DefaultDS"  pooled-location="jdbc/DefaultPooledDS"  xa-location="jdbc/xa/DefaultXADS"  ejb-location="jdbc/DefaultEJBDS"  url="jdbc:inetdae:localhost?database=dBTest" 
  -> dBTest is the name of the ODBC 
  datasource  connection-driver="com.inet.tds.TdsDriver"  username="[dB 
  Username]"  password="[dB Password]"/>
   
  The generic is the same, but with JDBC:ODBC:EJB in the URL 
  and the generic driver for connection-driver.
   
  derek Akers.


Re: client jars

2000-04-19 Thread Shayne Hughes

I'd like to know the answer to this one also...

- Original Message -
From: "Robert Krüger" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Wednesday, April 19, 2000 5:33 AM
Subject: client jars


>
> hi,
>
> are there plans to ship a minimal client.jar file with orion that can be
> distributed to application clients accessing orion? say I have an
> application that needs to access orion via http tunneling over the
internet
> and I do not want to distribute the entire orion.jar. is there an
> alternative apart from unjaring and repackaging what I need? What is the
> minimum I need to invoke an rmi method on an orion ejb (no client-side
> transactions etc.)?
>
> thanks,
>
> robert
>
> (-) Robert Krüger
> (-) SIGNAL 7 Gesellschaft für Informationstechnologie mbH
> (-) Brüder-Knauß-Str. 79 - 64285 Darmstadt,
> (-) Tel: 06151 665401, Fax: 06151 665373
> (-) [EMAIL PROTECTED], www.signal7.de
>
>






Re: CMP and Identity columns

2000-04-08 Thread Shayne Hughes

This is quite depressing considering that I need to hook to existing tables.
(I know, just don't use CMP).  It seems to me that, similar to how we can
specify the SQL for finders, we should be able to specify SQL for ejbCreate
and ejbPostCreate.

Thanks for all the suggestions.

Shayne


- Original Message -
From: Mike Cannon-Brookes <[EMAIL PROTECTED]>
To: Orion-Interest <[EMAIL PROTECTED]>
Sent: Friday, April 07, 2000 10:40 PM
Subject: RE: CMP and Identity columns


> Shayne,
>
> As far as I know you cannot use identity (or autonumber fields) with EJBs.
> You have to create the primary key within Java.
>
> Anyone else?
>
> Mike
>
> > -Original Message-
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Shayne Hughes
> > Sent: Saturday, 8 April 2000 9:38
> > To: Orion-Interest
> > Subject: CMP and Identity columns
> >
> >
> > I have a table on Microsoft SQL Server that has an identity column such
> > as...
> >
> > CREATE TABLE MyTable (
> >  id int IDENTITY (1, 1) PRIMARY KEY NOT NULL ,
> >  Name varchar (255) NULL
> > )
> >
> > I'd like to create a CMP EJB for this table.  Is it possible to instruct
> > Orion to not specify a value for the "id" field when inserting a
> > new row and
> > to execute the proper SQL command to get back the "id" of the new row?
> >
> > My classes only have create methods that specify "Name".  Here's
> > the message
> > from the exception that occurs...
> >
> > Error creating EntityBean: [ECOLI]Cannot insert explicit value
> > for identity
> > column in table 'GelGroup' when IDENTITY_INSERT is set to OFF.
> >
> > I hope this is on topic.  My reseach points to this being a
> > container config
> > thing.
> >
> > Shayne
> >
> >
> >
> >
>
>






CMP and Identity columns

2000-04-07 Thread Shayne Hughes

I have a table on Microsoft SQL Server that has an identity column such
as...

CREATE TABLE MyTable (
 id int IDENTITY (1, 1) PRIMARY KEY NOT NULL ,
 Name varchar (255) NULL
)

I'd like to create a CMP EJB for this table.  Is it possible to instruct
Orion to not specify a value for the "id" field when inserting a new row and
to execute the proper SQL command to get back the "id" of the new row?

My classes only have create methods that specify "Name".  Here's the message
from the exception that occurs...

Error creating EntityBean: [ECOLI]Cannot insert explicit value for identity
column in table 'GelGroup' when IDENTITY_INSERT is set to OFF.

I hope this is on topic.  My reseach points to this being a container config
thing.

Shayne






Re: Mysterious Hang

2000-02-05 Thread Shayne Hughes

I've seen something very similar (maybe identical), but I wrote it off to my
being an EJB newbie.  I was using the Cart example and modified the source
code to create and destroy ejbs as fast as possible.  It ranged from around
100 to 700 creates before it would hang.  I didn't have the restart the
server and I could run several of these clients at once.  They would always
hang, but never at a predictable iteration number.

Shayne

- Original Message -
From: <[EMAIL PROTECTED]>
To: Orion-Interest <[EMAIL PROTECTED]>
Sent: Friday, February 04, 2000 8:21 PM
Subject: Mysterious Hang


>
>
> I am attempting to load a large number of objects into my database using
the
> create method on an entity bean. I have a simple loop that reads a line
from a
> file, builds the create parameters and then calls create. I've
experimented with
> reusing the same context and home objects for each create as well as
getting a
> new context and home per iteration.
>
> I have the same behavior everytime. The program calling create simply
hangs at
> random places somewhere after 100-200 create operations. I had this same
program
> do over 15,000 creates using Jonas, so I feel that the client and the bean
are
> correct. The specific behavior is that the create call hangs on the client
and a
> debug statement in my bean indicates ejbCreate was never entered.
>
> I looked at it in jdb and noticed that at the time it hung the RMIthread
had
> exited. If I start another client the thread gets recreated and I can do
any
> number of operations on the same bean and different beans while the load
program
> is hung. Also interesting about this state is if I kill the Orion server,
the
> client remains hung.
>
> This is quite puzzling. Anybody else had similar experiences?
>
>
>