cancel
Showing results for 
Search instead for 
Did you mean: 

identity DB field in Data Dictionary Table

Former Member
0 Kudos
58

Hi

I am using NW04 SP9

I created a Data Dictionary DC and created a new TABLE.

I need one of the fields to be an IDENTITY field (that generates an ID automatically whenever a new record is craeted).

Q1. Is the Data Dictionary DC and Plug in (of NW04 SP9) support such a feature?

Q2. If the answer is no, what are my alternatives?

Accepted Solutions (0)

Answers (3)

Answers (3)

htammen
Active Contributor
0 Kudos

Hi Zach,

have a look at theserverside.com or a good J2EE book.

At theserverside.com search for "primary key".

e.g.: http://www.theserverside.com/news/thread.tss?thread_id=8707

If you are from Germany I can suggest the book "Enterprise JavaBeans 2.1" written by Martin Kompf and published by Galileo Computing.

If you prefer english you can find some online books at theserverside.com as well.

Regards

Helmut

Former Member
0 Kudos

thanks, but when i click on the link to the actulat chapter, it says the link is invalid.

i am talking about this link

http://www.theserverside.com/resources/patterns_review.jsp.

htammen
Active Contributor
0 Kudos

sorry. Register at the serverside.com (it´s free) you can then download PDF versions of several popular books. There are at least two J2EE books. I would also suggest the EJB Design Pattern book. Probably you´ll find a solution here.

You can also search for "primary key" and get a lot of entries which you can read.

The primary key problem is a common problem in distributed applications (not only J2EE). Therefore there are also solutions for it.

Regards

Helmut

Former Member
0 Kudos

I haven't been able to find this option in the documentation: http://help.sap.com/saphelp_nw04/helpdata/en/69/f9bc3d52f39d33e10000000a11405a/frameset.htm.

Former Member
0 Kudos

Does anyone know if this thread (from the SAP Business One forum) answers my Question above?

Former Member
0 Kudos

SAP Business One has absolutely nothing to do with the NWDI Data Dictionary.

katarzyna_fecht
Explorer
0 Kudos

Hi,

in Java Dictionary there is no possibility to generate primary keys and you have to generate them in the application layer.

If you use CMP entity beans you can declare the primary key as unknown; at runtime the EJB Container generates automatically the values for that primary key.

If you don't use EJB CMP you have to generate primary keys in the application. The popular techniques are GUID (string based primary keys), a related EJB pattern - you can find the description in many publications (an EJB session bean is generating unique and consecutive numbers using a database). Another possibility could be to generate unique numbers using the Enqueue Server instance in NetWeaver Java cluster. But these numbers are not consecutive.

Good luck, Katarzyna

Former Member
0 Kudos

can you please refer to a documentation regarding

generating unique numbers using the Enqueue Server instance in NetWeaver Java cluster?

katarzyna_fecht
Explorer
0 Kudos

Hi,

the enqueue method in question is called

getUniqueIncreasingNumber()

There is another SDN forum thread describing its invocation pretty well:

(in this thread you can also view the invocation of guid based strings, as guid based generation executes locally, it is a good idea to use it if primary keys can be strings, contrary, enqueue invocation implies connecting to the enqueue instance)

You can view the Javadoc for getUniqueIncreasingNumber()

in the local documentation of your Developer Studio installation (API WAS/J2EE Engine/com.sap.services.......applocking),

i just copy and paste it here:

"getUniqueIncreasingNumber

public long getUniqueIncreasingNumber()

throws com.sap.engine.frame.core.locking.TechnicalLockException

Returns a number with the following properties:

every method-call returns a higher number than the previous ones

the number contains the timestamp of the central server, so this will work correctly in a distributed environment and also after a restart of the cluster

This number can be used for every purpose, it is not locking-specific.

ATTENTION: if the system-time of the central server is changed this will probably not work correctly any more."

Note that the precondition is that you never change the system time of the Enqueue Instance (what is indeed in general not allowed in SAP systems, see the SAP note #771577). In the case of enqueue replication server, both system clocks have to be synchronized.

good luck, Katarzyna