I use Postgresql as well, but I couldn't figure out how to get container 
managed entity beans to automatically set the primary key from the SEQUENCE
data type.  I ended up creating a session bean to grab sequence numbers 
from the database each time I created an entity bean.  

Is there a better way?  I'm all for it---creating two beans every time I need 
one is not my idea of a good way to spend time.  

--phil--

On Thu, 15 Jun 2000 08:33:58 -0400 "John M. Jones" writes
+--------------------
| Does your database support serial fields? These fields generate a counter
| for each record added. There's a trick to getting the next id when calling
| create(), but it eliviates coding a unique id generator. I use PostgreSQL,
| and it has a serial data type.
| 
| Hope this helps,
| John
| 
| -----Original Message-----
| From: [EMAIL PROTECTED]
| [mailto:[EMAIL PROTECTED]]On Behalf Of Blasius Lofi
| Dewanto
| Sent: Thursday, June 15, 2000 5:13 AM
| To: [EMAIL PROTECTED]
| Subject: Automatic counter
| 
| 
| Hi all,
| 
| I just wonder, whether someone can help me...
| 
| How can I implement a counter or a unique id
| for my PrimaryKey in EJB? Because I don't want
| to take care about it in my EJB.
| 
| Another question:
| When I quit from the EJBServer through the JonasAdmin,
| I always get this exception:
| Cannot unbind Datasources: java.lang.ClassCastException
| Is this normal?
| 
| Thank's a lot!
| --
| ---------------------------------------------------
| Blasius Lofi Dewanto
| ---------------------------------------------------
| OpenUSS - Open Source University Support System
|           http://openuss.sourceforge.net
| ---------------------------------------------------
| 
| 
| __________________________________________________________________
| Do You Yahoo!?
| Gesendet von Yahoo! Mail - http://mail.yahoo.de
| Yahoo! Auktionen - gleich ausprobieren - http://auktionen.yahoo.de
| 
| ----
| To unsubscribe, send email to [EMAIL PROTECTED] and
| include in the body of the message "unsubscribe jonas-users".
| For general help, send email to [EMAIL PROTECTED] and
| include in the body of the message "help".
| 
| ----
| To unsubscribe, send email to [EMAIL PROTECTED] and
| include in the body of the message "unsubscribe jonas-users".
| For general help, send email to [EMAIL PROTECTED] and
| include in the body of the message "help".
| 

----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".

Reply via email to