Access to optimistic lock revision number
We have an existing schema that includes a REVISION column. The current JDBC
code base increments the revision number each time an object is updated.
Ideally I would like to use this same field for Kodo's optimistic locking
mechanism and let Kodo manage the field. The problem is that we need
(read-only) access to the revision value for other purposes. Is there a way
to get this value? I'm okay with using a Kodo-specific API.
Thanks,
Tom
Sadly, the mechanism for doing this isn't very well-documented, so here
goes:
import com.solarmetric.kodo.runtime.*;
PersistenceManagerImpl pm = (PersistenceManagerImpl) pman;
StateManagerImpl sm = pm.getState (persistentObject);
Object version = sm.getVersion ();
This object is a Number when used with our JDBC back-end.
-Patrick
On Sat, 02 Aug 2003 09:26:47 -0700, thomasrlandon wrote:
We have an existing schema that includes a REVISION column. The current JDBC
code base increments the revision number each time an object is updated.
Ideally I would like to use this same field for Kodo's optimistic locking
mechanism and let Kodo manage the field. The problem is that we need
(read-only) access to the revision value for other purposes. Is there a way
to get this value? I'm okay with using a Kodo-specific API.
Thanks,
Tom--
Patrick Linskey
SolarMetric Inc.
Similar Messages
-
Optimistic Locking fails when version field is part of a Aggregate
I'm trying to persist a Mapped Object using 9.0.3 Toplink.
The object uses optimistic locking while the Timestamp versioning field is part of an Aggreate Descriptor. This works well in the Workbench (does not complain).
Unfortunally it does not work whenever I use the UnitOfWork to register and commit the chances.
Sample code:
Object original;
UnitOfWork unitOfWork = ...
Object clone = unitOfWork.registerExistingObject(original);
clone.setBarcode("bliblalbu");
unitOfWork.commit();This throws an nasty OptimisticLockException, complaining about a missing versioning field:
LOCAL EXCEPTION STACK:
EXCEPTION [TOPLINK-5004] (TopLink - 9.0.3 (Build 423)): oracle.toplink.exceptions.OptimisticLockException
EXCEPTION DESCRIPTION: An attempt was made to update the object [BusinessObject:{id:12382902,shorttext:null,barcode:bliblablu,ownerLocation:null,IdEntryName:0,idCs:20579121}], but it has no version number in the identity map.
It may not have been read before the update was attempted.
CLASS> de.grob.wps.domain.model.BusinessObjectBO PK> [12382902]
at oracle.toplink.exceptions.OptimisticLockException.noVersionNumberWhenUpdating(Unknown Source)
at oracle.toplink.descriptors.VersionLockingPolicy.addLockValuesToTranslationRow(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.updateObjectForWrite(Unknown Source)
at oracle.toplink.queryframework.WriteObjectQuery.executeCommit(Unknown Source)
at oracle.toplink.internal.queryframework.DatabaseQueryMechanism.executeWrite(Unknown Source)
at oracle.toplink.queryframework.WriteObjectQuery.execute(Unknown Source)
at oracle.toplink.queryframework.DatabaseQuery.execute(Unknown Source)
at oracle.toplink.publicinterface.Session.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.internalExecuteQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.publicinterface.Session.executeQuery(Unknown Source)
at oracle.toplink.internal.sessions.CommitManager.commitAllObjects(Unknown Source)
at oracle.toplink.publicinterface.Session.writeAllObjects(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.commitToDatabase(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.commitRootUnitOfWork(Unknown Source)
at oracle.toplink.publicinterface.UnitOfWork.commitAndResume(Unknown Source)
at de.grob.wps.dwarf.domainstore.toplink.ToplinkTransaction.commit(ToplinkTransaction.java:60)
at de.grob.wps.dwarf.domainstore.toplink.ToplinkPersistenceManager.commit(ToplinkPersistenceManager.java:396)
at de.grob.wps.dwarf.domainstore.toplink.ToplinkPersistenceManagerTest.testPersistSerializableWithBusinessObjects(ToplinkPersistenceManagerTest.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)So what can I to fix this problem? BTW the Object I try to persists has been read from database and the IDE debugger shows what that the aggregate object contains java.sql.Timestamp instances.Sorry guys. My debugger fooled me. The locking field wasn't initialized in the database. This caused the problem which is fixed now.
Thx anyway.
Bye
Toby -
High concurrency optimistic locking
Hi there,
We have an EJB method that roughly does the following; we have a number of buckets that may or may not be full. If one or more are not full we want it to find the one with the most space available and add the item there. Our main problem here is that this method can be called upwards of 1000 times per second and we're now looking for an efficient way to solve the concurrency issue of two different calls both thinking bucket X has space left even though one of the two calls will fill it up :
THREAD 1 : findEmptyBucket() returns BUCKET1 (1 SPOT LEFT)
THREAD 2 : findEmptyBucket() returns BUCKET1 (1 SPOT LEFT)
THREAD 1 : addItemToBucket(BUCKET1) <- FULL NOW
THREAD 2 : addItemToBucket(BUCKET1) <- WRONG
Since only optimistic locking is available in the spec for some reason I think the "EJB3" approach is basically (pseudoish) :
while(!succeeded) {
try {
Bucket b = findEmptyBucket(...); // Will throw OptimisticLockException?
addItemToBucket(b, item);
succeeded = true;
catch(OptimisticLockException e) {}
} This seems horribly inefficient for a call that is almost guaranteed to require dozens of retries during peak hours. Is there any way to optimize this in such a way that we don't have to use optimistic locking? We're trying to solve this without using vendor specific solutions but EJB3 seems to lack the necessary functionality. Suggestions definitely welcome, evne if they are "that's the only way to do it" ;)
Thanks!I think the OptimisticLockingException is thrown after-the-fact. So, if the addItemToBucket() method does a commit (flush), it will generate the exception rather than the find method. Otherwise, if there is no explicit commit call, the exception will be thrown when the EJB method that holds the while loop returns.
If performance is critical, maybe a Stateful SessionBean with a Stateless Facade would work better. Create a Stateless SessionBean with an addItem() method and a reference to a single stateful bean. The implementation of the stateful session bean would be something like the following standalone program. The stateful bean would have an addItem() method too, but would keep track of a pool of resources internally.
class ItemBucket { Item i; }
class Item { String data; }
class NoBucketsAvailableException extends Exception {}
public class bucket {
final static int POOL_SIZE = 4;
ItemBucket[] bucketPool = new ItemBucket[POOL_SIZE];
Object[] bucketLocks = new Object[POOL_SIZE];
void initBucketPool() {
for(int i=0; i<POOL_SIZE; i++) {
bucketPool[i] = new ItemBucket();
bucketLocks[i] = new Object();
void addItemToEmptyBucket(Item _i) throws NoBucketsAvailableException {
int i=0;
for(; i<POOL_SIZE; i++) {
if( bucketPool.i == null ) { // possible empty bucket
synchronized(bucketLocks[i]) {
if( bucketPool[i].i == null ) { // double checked locking
bucketPool[i].i = _i;
if( i >= POOL_SIZE) { throw new NoBucketsAvailableException(); }
public static void main(String[] args) {
bucket app = new bucket();
app.initBucketPool();
Item item = new Item();
item.data = "test";
try {
app.addItemToEmptyBucket(item);
catch(NoBucketsAvailableException exc) {} -
Locked Personnel number in ESS
We have an issue where occassional employees accessing CATS receive the Personnel Number is locked error, but there is no locked record entry in SM12 or program HFIUCPL0.
For a couple of users in-particular this has been ongoing for over a month!
I am now looking at switching off Work Protect mode, but need to restrict it to the individual and not across the company; we have the Personalization link turned off in ESS itself, so the user can't update it themselves. Is there a way to maintain it on their behalf through ECC (I have been through SU01 and can't find a personalization setting or parameter that refers to it, but may be missing something)
Any help/advice would be greatly appreciated.
Simon
Edited by: Simon Worthington on Nov 12, 2010 4:54 PMMake sure you review the attached note 596698.
Please apply the following steps:
1. Open the Record working time iView for editing in the Content
Administrator.
2. Set the iView property "Application Parameters" to
"sap-wd-enforcesessionmanagement=ok"
3. click on Save. -
Optimistic locking and HTML DB checksum calculation
I create a form for fetching and updating row from a database table. I use Automated Row Fetch for fetching row. But for updating row I must use a procedure from a package, not Automatic Row Processing (DML).
And my question is: how I can implement optimistic locking in this way?
Automated Row Fetch already calculated checksum and stored it in p_md5_checksum hidden field, can I get calculated value of checksum from p_md5_checksum?
How I can calculate checksum by myself for compare with value from p_md5_checksum?
What algorithm uses HTML DB for calculate checksum in Automated Row Fetch and Automatic Row Processing (DML) components?I have read this topic already. It's recommended to build own functionality for calculate checksum, but Automated Row Fetch already calculated checksum and stored it in p_md5_checksum hidden field.
I also created my own function, for example for table dept:
create or replace function BUILD_DEPT_MD5 (
P_DEPTNO in number,
P_DNAME in varchar2 default null,
P_LOC in varchar2 default null,
P_COL_SEP in varchar2 default '|') return varchar2 is
begin
return utl_raw.cast_to_raw(dbms_obfuscation_toolkit.md5(input_string => P_DEPTNO || P_COL_SEP || P_DNAME || P_COL_SEP || P_LOC));
end BUILD_DEPT_MD5;
but checksum values what calculated with this function is not equal with checksum value calculated by Automated Row Fetch.
I shall specify:
I need to use Automated Row Fetch for get row from table.
I can not use Automatic Row Processing (DML) for update row, I need use PL/SQL procedure for this.
I want implement optimistic locking and I want use for this a checksum value, what already calculated by Automated Row Fetch. I need to know how I can get this checksum value and I need to know algorithm, which Automated Row Fetch uses for checksum calculation. -
Optimistic Lock with Parent and Child relationships
Hi,
I just have a question regarding optimistic locking. We have a scenario
where a parent object has many child objects. Both the parent and the
child objects have a jdolockx column in the database/jdo file.
It appears that whenever you add a new child to the parent the parent's
optimistic lock counter is also updated.
eg
parent.getChildren().add(child);
child.setParent(parent);
Why does this occur? There is no change made to the database table for
the parent, except for the jdolockx column. Is there something that I can
do to stop the lock count from incrementing when I child is added?
We have a scenario where we have many threads of execution wishing to add
children to a single parent. The parent itself isnt modified but this
operation fails due to the parent lock counter being incremented.
Any help would be appreciated
Thanks
LukeThere is state image indicator in Kodo 3 which has more locking options
beyond a simple number:
http://solarmetric.com/Software/Documentation/3.0.1/docs/ref_guide_mapping_versionind.html#state-image
In addition, you can plug your own version indicator.
Our default optimistic locking avoids the problem of users having no
idea what is -actually- in the collection/set at any given time.
Inconsistencies can occur at the datastore level (user 1 adds
object a to collection, user 2 removes a, user 1 adds object b... which
should actually be in the DB? {a,b} or or {a}? This is one of the
many ways in which not tracking changes to a collection/set can be
hazardous).
On locking exceptions, errors could be handled in some appropriate
function (i.e. refresh, re-apply changes if applicable/safe,
and commit).
Luke wrote:
Hi,
I just have a question regarding optimistic locking. We have a scenario
where a parent object has many child objects. Both the parent and the
child objects have a jdolockx column in the database/jdo file.
It appears that whenever you add a new child to the parent the parent's
optimistic lock counter is also updated.
eg
parent.getChildren().add(child);
child.setParent(parent);
Why does this occur? There is no change made to the database table for
the parent, except for the jdolockx column. Is there something that I can
do to stop the lock count from incrementing when I child is added?
We have a scenario where we have many threads of execution wishing to add
children to a single parent. The parent itself isnt modified but this
operation fails due to the parent lock counter being incremented.
Any help would be appreciated
Thanks
Luke
Steve Kim
[email protected]
SolarMetric Inc.
http://www.solarmetric.com -
10g Locks Up when selecting database field for optimistic locking
As the subject says, when I attempt to select the database field for optimistic locking, JDeveloper locks up and I have to kill it with the task manager.
Should I post problems with TopLink in 10g in this forum or the TopLink forum?I finally hit this StackOverflowError again. This happens sometimes when I select the Locking tab on a class where the locking field has already been selected. Here is the top of the stack trace:
java.lang.StackOverflowError
at java.util.TreeMap$KeyIterator.next(TreeMap.java:1047)
at java.util.TreeMap.buildFromSorted(TreeMap.java:1588)
at java.util.TreeMap.buildFromSorted(TreeMap.java:1534)
at java.util.TreeMap.addAllForTreeSet(TreeMap.java:1492)
at java.util.TreeSet.addAll(TreeSet.java:247)
at java.util.TreeSet.<init>(TreeSet.java:138)
at oracle.toplink.workbench.model.desc.MWClassDescriptor.getAssociatedTablesCopy(MWClassDescriptor.java:377)
at oracle.toplink.workbench.model.desc.MWClassDescriptor.getSecondaryTablesCopy(MWClassDescriptor.java:698)
at oracle.toplink.workbench.model.desc.MWClassDescriptor.hasMultipleTables(MWClassDescriptor.java:796)
at oracle.toplink.workbench.ui.labels.DatabaseFieldLabel.isMultiTable(DatabaseFieldLabel.java:120)
at oracle.toplink.workbench.ui.labels.DatabaseFieldLabel.installUI(DatabaseFieldLabel.java:93)
at oracle.toplink.uitools.cell.BasicLabel.prepareLabel(BasicLabel.java:953)
at oracle.toplink.uitools.cell.BasicLabel.getListCellRendererComponent(BasicLabel.java:611)
at oracle.toplink.uitools.plaf.basic.BasicListChooserUI$RendererWrapper.getListCellRendererComponent(BasicListChooserUI.java:1104)
at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1147)
at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1097)
at javax.swing.plaf.basic.BasicListUI$ListSelectionHandler.valueChanged(BasicListUI.java:1465)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:187)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:167)
at javax.swing.DefaultListSelectionModel.fireValueChanged(DefaultListSelectionModel.java:214)
at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:402)
at javax.swing.DefaultListSelectionModel.changeSelection(DefaultListSelectionModel.java:411)
at javax.swing.DefaultListSelectionModel.setSelectionInterval(DefaultListSelectionModel.java:435)
at javax.swing.JList.setSelectedIndex(JList.java:1730)
at javax.swing.plaf.basic.BasicComboPopup.setListSelection(BasicComboPopup.java:998)
at javax.swing.plaf.basic.BasicComboPopup.access$000(BasicComboPopup.java:43)
at javax.swing.plaf.basic.BasicComboPopup$ItemHandler.itemStateChanged(BasicComboPopup.java:782)
at javax.swing.JComboBox.fireItemStateChanged(JComboBox.java:1161)
at javax.swing.JComboBox.selectedItemChanged(JComboBox.java:1218)
at oracle.toplink.uitools.ComboBox.selectedItemChanged(ComboBox.java:512)
at javax.swing.JComboBox.contentsChanged(JComboBox.java:1265)
at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
at oracle.toplink.uitools.plaf.basic.BasicListChooserUI$ComboBoxModel.fireContentsChanged(BasicListChooserUI.java:598)
at oracle.toplink.uitools.plaf.basic.BasicListChooserUI$ListDataHandler.contentsChanged(BasicListChooserUI.java:842)
at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
at oracle.toplink.uitools.DefaultListModel.setSelectedItem(DefaultListModel.java:830)
at oracle.toplink.uitools.DefaultListModel.removeAll(DefaultListModel.java:529)
at oracle.toplink.uitools.DefaultListModel.replace(DefaultListModel.java:724)
at oracle.toplink.uitools.ListChooser.setData(ListChooser.java:747)
at oracle.toplink.workbench.ui.desc.DescriptorPropertiesLockingPage.populateOptimisticFieldChooser(DescriptorPropertiesLockingPage.java:333)
at oracle.toplink.workbench.ui.desc.DescriptorPropertiesLockingPage.propertyChange(DescriptorPropertiesLockingPage.java:342)
at oracle.toplink.workbench.tools.events.ChangeSupport.firePropertyChange(ChangeSupport.java:216)
at oracle.toplink.workbench.tools.events.ChangeSupport.firePropertyChange(ChangeSupport.java:230)
at oracle.toplink.workbench.tools.AbstractModel.firePropertyChange(AbstractModel.java:70)
at oracle.toplink.workbench.model.desc.MWDescriptorLockingPolicy.setLockField(MWDescriptorLockingPolicy.java:117)
at oracle.toplink.workbench.ui.desc.DescriptorPropertiesLockingPage$ActionHandler.actionPerformed(DescriptorPropertiesLockingPage.java:471)
at oracle.toplink.uitools.Chooser.fireActionEvent(Chooser.java:305)
at oracle.toplink.uitools.ListChooser$ListDataHandler.contentsChanged(ListChooser.java:1382)
at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
at oracle.toplink.uitools.DefaultListModel.setSelectedItem(DefaultListModel.java:830)
at oracle.toplink.uitools.DefaultListModel.replace(DefaultListModel.java:732)
at oracle.toplink.uitools.ListChooser.setData(ListChooser.java:747)
at oracle.toplink.workbench.ui.desc.DescriptorPropertiesLockingPage.populateOptimisticFieldChooser(DescriptorPropertiesLockingPage.java:333)
at oracle.toplink.workbench.ui.desc.DescriptorPropertiesLockingPage.propertyChange(DescriptorPropertiesLockingPage.java:342)
at oracle.toplink.workbench.tools.events.ChangeSupport.firePropertyChange(ChangeSupport.java:216)
at oracle.toplink.workbench.tools.events.ChangeSupport.firePropertyChange(ChangeSupport.java:230)
at oracle.toplink.workbench.tools.AbstractModel.firePropertyChange(AbstractModel.java:70)
at oracle.toplink.workbench.model.desc.MWDescriptorLockingPolicy.setLockField(MWDescriptorLockingPolicy.java:117)
at oracle.toplink.workbench.ui.desc.DescriptorPropertiesLockingPage$ActionHandler.actionPerformed(DescriptorPropertiesLockingPage.java:471)
at oracle.toplink.uitools.Chooser.fireActionEvent(Chooser.java:305)
at oracle.toplink.uitools.ListChooser$ListDataHandler.contentsChanged(ListChooser.java:1382)
at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
at oracle.toplink.uitools.DefaultListModel.setSelectedItem(DefaultListModel.java:830)
at oracle.toplink.uitools.DefaultListModel.replace(DefaultListModel.java:732)
at oracle.toplink.uitools.ListChooser.setData(ListChooser.java:747)
at oracle.toplink.workbench.ui.desc.DescriptorPropertiesLockingPage.populateOptimisticFieldChooser(DescriptorPropertiesLockingPage.java:333)
at oracle.toplink.workbench.ui.desc.DescriptorPropertiesLockingPage.propertyChange(DescriptorPropertiesLockingPage.java:342)
at oracle.toplink.workbench.tools.events.ChangeSupport.firePropertyChange(ChangeSupport.java:216)
at oracle.toplink.workbench.tools.events.ChangeSupport.firePropertyChange(ChangeSupport.java:230)
at oracle.toplink.workbench.tools.AbstractModel.firePropertyChange(AbstractModel.java:70)
at oracle.toplink.workbench.model.desc.MWDescriptorLockingPolicy.setLockField(MWDescriptorLockingPolicy.java:117)
at oracle.toplink.workbench.ui.desc.DescriptorPropertiesLockingPage$ActionHandler.actionPerformed(DescriptorPropertiesLockingPage.java:471)
at oracle.toplink.uitools.Chooser.fireActionEvent(Chooser.java:305)
at oracle.toplink.uitools.ListChooser$ListDataHandler.contentsChanged(ListChooser.java:1382)
at javax.swing.AbstractListModel.fireContentsChanged(AbstractListModel.java:100)
... -
Query using Optimistic Locking
Hello all ,
"With optimistic locking, a resource is not actually locked when it is first is accessed by a transaction."
Is optimistic locking used for banking applications ??
Please share your ideas , share your ideas.Thanks in advance.Can optimistic locking be used for banking applications? Sure. Is it always appropriate for every possible banking related application? No.
You'll need to be a lot more specific about your application's requirements before we can say anything with much specificity. In general, banking or non-banking, OLTP applications ought to be using optimistic locking and any application that uses pessimistic locking needs to be careful not to hold locks across user interaction events (i.e. don't allow a user to lock a row and then head out to lunch without releasing the lock).
Justin -
Pessimistic or optimistic locking
It is highly appreciated someone can provide me with answer to following question.
does iplanet use pessimistic or optimistic locking when ejb associated with transaction accessing the database ?
thanks & regards
DannyHi brother
I think that this link can help you
http://download-east.oracle.com/docs/cd/A97688_16/toplink.903/b10064/database.htm#1007986
Good luck -
VTP revision number and VLAN database updates
Hi - Theoretically, is the following possible ?
We have an established network on VTP domain say - CORP where we have a core switch performing the VLAN/VTP updates.
Someone plugs in a rogue switch to the network - say configured for a different VTP domain TEST, or maybe just a default undefined VTP domain. If the VTP Revision number of the rogue switch is higher than the Core Switch(CORP) - can the rogue switch wipe out the VLANs on CORP ?
My understanding from VTP is that the server and client need to be on the same domain for updates to occur flowing from the Server to the Client. But, also read somewhere that VTP revision is more something that needs to be a watch out for.
In question would be a CAT 6506 being the Server, and the roque being any switch - even a Cisco 2940 which we might typically user for conference rooms.
pls advise
thanks in advanceA switch if not configured for any vtp domain, defaulting to null, when plugged into a life network, it will join the domain that it learns about via vtp.
Also, a switch in vtp client mode, eventhough is not possible to configure vlan info on it, but will still propagate it's vlan d/b info via vtp. Therefore, if a client has a higher revision number then the one in the life network, therefore it will still wipe out the current VLANs in the life network replacing it with whatever that it has in it's own database.
There are 3 ways to avoid this:
1. Configure vtp mode of switch fr client to transparent, then switch it back to client mode. This will reset the vtp rev. back to 0.
2. Configure it to a different vtp domain, then switch it back. This will also reset the vtp rev. back to 0.
3. Configure ur switch uplink as an access port. VTP info will only propagate through trunks.
HTH. -
How to find revision number on my macbook ?
How to find revision number on my macbook ?
Wrong question, as there has been no formal revision number issued by Apple. What you may have seen on some postings about revision C, D, etc. is probably no more than rumor.
You can get some information about the place and date of production of your computer by selecting the "Blue Apple" in your menu bar, then selecting About this Mac. Press More, then look at your serial number.
My serial number is W8612xxxxx..
"W8" lists the production location in China.
"612" means that my MBP was produced in the 12th week of 2006.
One of the defects in early production runs was a noisy inverter for the LCD screen. It's likely that that was a parts problem that was remedied in progress of production. My "week 12" MBP has no problems at all.
My MBP runs a bit hot, but within specs. For that matter, I found the TiBook it replaced was uncomfortably warm as a laptop. There's a simple remedy if you want work in laptop mode. Just put something -- a notebook, a rigid plastic sheet a few millimeters thick or the like -- under the MBP and you (and the computer) will be more comfortable. -
Hello everyone !
I run into this problem today ... take a look on the code :
import com.trick7.effects.TeraFire;
for (var j:uint=0; j<10; j++) {
var fire:TeraFire = new TeraFire();
fire.x = j * 40 + 20;
fire.y = 100;
fire.number = j; //This line is causeing the problem
addChild(fire);
fire.buttonMode = true;
TeraFire class creates fire particles. The compiler error is :
Scene 1, Layer 'Layer 1', Frame 1, Line 7
1119: Access of possibly undefined property number through a reference with static type com.trick7.effects:TeraFire.
Anyone can help me to find a solution to this problem.
I can do that ".number" with a movieclip but not in this case. What can I do ?I borrowed that class from the internet.
I made the changes you suggested: imported flash.Display.MovieClip and also made the class extend MovieClip.
The error is still throwing in compiler errors. I am not really good enough to edit this class because there are some functions I don't still understand very good. This is the class below:
package com.trick7.effects{
import flash.display.BitmapData;
import flash.display.GradientType;
import flash.display.MovieClip;
import flash.events.Event;
import flash.filters.DisplacementMapFilter;
import flash.filters.DisplacementMapFilterMode;
import flash.geom.Matrix;
import flash.geom.Point;
import flash.geom.Rectangle;
public class TeraFire extends MovieClip{
public var phaseRateX:Number;
public var phaseRateY:Number;
private var offsets:Array= [new Point(),new Point()];
private var seed:Number = Math.random();
private var fireW:Number;
private var fireH:Number;
//火の色
//private var fireColorIn:uint;
//private var fireColorOut:uint;
private var ball:Sprite;
private var gradientImage:BitmapData;
private var displaceImage:BitmapData;
private var focalPointRatio:Number = 0.6;
private const margin:int = 10;
private var rdm:Number;
public function TeraFire(xPos:Number=0, yPos:Number=0, fireWidth:Number=30, fireHeight:Number=90, fireColorIn:uint = 0xFFCC00,fireColorOut:uint = 0xE22D09){
fireW = fireWidth;
fireH = fireHeight;
phaseRateX = 0;
phaseRateY = 5;
var matrix:Matrix = new Matrix();
matrix.createGradientBox(fireW,fireH,Math.PI/2,-fireW/2,-fireH*(focalPointRatio+1)/2);
var colors:Array = [fireColorIn, fireColorOut, fireColorOut];
var alphas:Array = [1,1,0];
var ratios:Array = [30, 100, 220];
var home:Sprite = new Sprite();
ball = new Sprite();
ball.graphics.beginGradientFill(GradientType.RADIAL,colors, alphas, ratios, matrix,"pad","rgb",focalPointRatio);
ball.graphics.drawEllipse(-fireW/2,-fireH*(focalPointRatio+1)/2,fireW,fireH);
ball.graphics.endFill();
//余白確保用透明矩形
ball.graphics.beginFill(0x000000,0);
ball.graphics.drawRect(-fireW/2,0,fireW+margin,1);
ball.graphics.endFill();
addChild(home);
home.addChild(ball);
this.x = xPos;
this.y = yPos;
addEventListener(Event.ENTER_FRAME,loop);
displaceImage = new BitmapData(fireW+margin,fireH,false,0xFFFFFFFF);
var matrix2:Matrix = new Matrix();
matrix2.createGradientBox(fireW+margin,fireH,Math.PI/2,0,0);
var gradient_mc:Sprite = new Sprite;
gradient_mc.graphics.beginGradientFill(GradientType.LINEAR,[0x666666,0x666666], [0,1], [120,220], matrix2);
gradient_mc.graphics.drawRect(0,0,fireW+margin,fireH);//drawのターゲットなので生成位置にこだわる必要はない。
gradient_mc.graphics.endFill();
gradientImage = new BitmapData(fireW+margin,fireH,true,0x00FFFFFF);
gradientImage.draw(gradient_mc);//gradient_mcを消す必要は?
rdm = Math.floor(Math.random()*10);
private function loop(e:Event):void{
for(var i:int = 0; i < 2; ++i){
offsets[i].x += phaseRateX;
offsets[i].y += phaseRateY;
displaceImage.perlinNoise(30+rdm, 60+rdm, 2, seed, false, false, 7, true, offsets);
displaceImage.copyPixels(gradientImage,gradientImage.rect,new Point(),null, null, true);
var dMap:DisplacementMapFilter = new DisplacementMapFilter(displaceImage, new Point(), 1, 1, 20, 10, DisplacementMapFilterMode.CLAMP);
ball.filters = [dMap];
I you can clarify a little bit further I would appreciate it a lot because I wasted some good time on this. -
Toplink Optimistic Locking not working with Session Bean facade.
I am working on Oracle JDeveloper v 10.1.2 and connecting to an Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit
The application is based on J2EE architecture and the technology stack uses Struts for presentation/controller framework, Stateless Session EJBs as session facade for custom business services, Simple java classes for the business services, Toplink implementation of DAO layer, Domain objects are mapped to database tables using Toplink Workbench that ships with JDeveloper. The transaction is managed by the session bean and hence the toplink session is configured to use external transaction controller and a named datasource as follows.
<session xsi:type="server-session">
<name>DBSession</name>
<server-platform xsi:type="oc4j-1012-platform"/>
<event-listener-classes/>
<logging xsi:type="toplink-log">
<log-level>fine</log-level>
<file-name>D:/ToplinkLog.log</file-name>
</logging>
<primary-project xsi:type="xml">META-INF/toplink-descriptor.xml</primary-project>
<login xsi:type="database-login">
<platform-class>oracle.toplink.platform.database.oracle.Oracle10Platform</platform-class>
<external-connection-pooling>true</external-connection-pooling>
<external-transaction-controller>true</external-transaction-controller>
<sequencing>
<default-sequence xsi:type="native-sequence">
<name>Native</name>
<preallocation-size>1</preallocation-size>
</default-sequence>
</sequencing>
<datasource>jdbc/ORADS</datasource>
</login>
</session>
We intend to use Optimistic Locking based on Timestamp-version locking through an audit field "last_modification_date" of type java.sql.Timestamp. The corresponding database field is also of type Timestamp(6). We are not storing the version in cache.
The problem we are facing is as follows.. we have an edit screen from where user can edit values for a domain object which are then persisted using Toplink...we expect Toplink to check the database record version (modification_date timestamp) before it applies the update. In DAO implementation, we register the object in a unitOfWork, then set the modified values, however we leave the modification_date (version field) unedited. Now when the application is running, on edit, an exception is thrown by the Session bean before ending the transaction.
com.evermind.server.rmi.OrionRemoteException: Transaction was rolled back: Error in transaction: java.lang.NullPointerException
at TrackingMediator_StatelessSessionBeanWrapper2.editOverheadExpenditure(TrackingMediator_StatelessSessionBeanWrapper2.java:1597)
at com.enbridge.dsm.web.action.TrackingPortfolioAction.editOverheadExpenditure(TrackingPortfolioAction.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:278)
at com.enbridge.dsm.web.shared.BaseAction.execute(BaseAction.java:90)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
at com.enbridge.dsm.web.shared.DSMPojoRequestProcessor.process(DSMPojoRequestProcessor.java:182)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1425)
at com.sourcebeat.strutslive.common.SLActionServlet.process(SLActionServlet.java:44)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at com.enbridge.dsm.web.shared.security.SecurityFilter.doFilter(SecurityFilter.java:142)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:645)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Nested exception is:
java.lang.NullPointerException
at oracle.jdbc.driver.PhysicalConnection.commit(PhysicalConnection.java:1190)
at com.evermind.sql.FilterConnection.commit(FilterConnection.java:209)
at com.evermind.sql.DriverManagerXAConnection.commit(DriverManagerXAConnection.java:203)
at com.evermind.server.TransactionEnlistment.commit(TransactionEnlistment.java:251)
at com.evermind.server.ApplicationServerTransaction.singlePhaseCommit(ApplicationServerTransaction.java:745)
at com.evermind.server.ApplicationServerTransaction.commit(ApplicationServerTransaction.java:690)
at com.evermind.server.ApplicationServerTransaction.end(ApplicationServerTransaction.java:1035)
at TrackingMediator_StatelessSessionBeanWrapper2.editOverheadExpenditure(TrackingMediator_StatelessSessionBeanWrapper2.java:1593)
at com.enbridge.dsm.web.action.TrackingPortfolioAction.editOverheadExpenditure(TrackingPortfolioAction.java:264)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:278)
at com.enbridge.dsm.web.shared.BaseAction.execute(BaseAction.java:90)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:465)
at com.enbridge.dsm.web.shared.DSMPojoRequestProcessor.process(DSMPojoRequestProcessor.java:182)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1425)
at com.sourcebeat.strutslive.common.SLActionServlet.process(SLActionServlet.java:44)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
at com.enbridge.dsm.web.shared.security.SecurityFilter.doFilter(SecurityFilter.java:142)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:645)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
Note that the exception is thrown at the time when the session bean is about to commit the transaction. i.e. the DAO code did not throw any exception and was able to check the optimistic locking and submit the update transaction.
I am not able to understand why is the the EJB throwing this weird error with Optimistic locking implementation. The application is working fine when the optimistic locking is disabled.
I am facing another problem due to this problem... since the session bean throws this exception after exiting the bean implemented method, when trying to commit the transaction, I am not able to mark the session context to setRollbackOnly. Hence if I continue on to another transaction by navigating to another screen in the application, mysteriously the previous transaction gets committed!!... again... weird...I am using JDBC driver version 10.1.2.
I saw this additional error message in JDeveloper console, which for some reason was not logged to my log4j log file... if it helps...
06/09/22 18:32:10 Thr[thread 6]-TransactionEnlistment.TransactionEnlistment.Caught forgetandRollback XAException e null
Here are the logs from my Toplink log file....
[TopLink Info]: 2006.09.22 06:31:46.546--ServerSession(989)--Thread(Thread[HttpRequestHandler-86,5,main])--TopLink, version: Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)
[TopLink Info]: 2006.09.22 06:31:46.578--ServerSession(989)--Thread(Thread[HttpRequestHandler-86,5,main])--Server: Oracle Application Server Containers for J2EE 10g (10.1.2.0.0)
[TopLink Config]: 2006.09.22 06:31:46.593--ServerSession(989)--Connection(991)--Thread(Thread[HttpRequestHandler-86,5,main])--connecting(DatabaseLogin(
platform=>Oracle10Platform
user name=> ""
connector=>JNDIConnector datasource name=>jdbc/ORADS
[TopLink Config]: 2006.09.22 06:31:47.484--ServerSession(989)--Connection(1432)--Thread(Thread[HttpRequestHandler-86,5,main])--Connected: jdbc:oracle:thin:@10.210.16.37:1521:orabld
User: APP_USR
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 10.1.0.3.0
[TopLink Config]: 2006.09.22 06:31:47.500--ServerSession(989)--Connection(1433)--Thread(Thread[HttpRequestHandler-86,5,main])--connecting(DatabaseLogin(
platform=>Oracle10Platform
user name=> ""
connector=>JNDIConnector datasource name=>jdbc/ORADS
[TopLink Config]: 2006.09.22 06:31:47.500--ServerSession(989)--Connection(1434)--Thread(Thread[HttpRequestHandler-86,5,main])--Connected: jdbc:oracle:thin:@10.210.16.37:1521:orabld
User: APP_USR
Database: Oracle Version: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
Driver: Oracle JDBC driver Version: 10.1.0.3.0
[TopLink Info]: 2006.09.22 06:31:47.671--ServerSession(989)--Thread(Thread[HttpRequestHandler-86,5,main])--DBSession login successful
[TopLink Fine]: 2006.09.22 06:31:47.703--ServerSession(989)--Connection(1554)--Thread(Thread[HttpRequestHandler-86,5,main])--select * from user_role ur, app_resource ar, role_resource rr where rr.APP_RESOURCE_ID = ar.APP_RESOURCE_ID and rr.USER_ROLE_ID = ur.USER_ROLE_ID
[TopLink Fine]: 2006.09.22 06:31:49.937--ServerSession(989)--Connection(10245)--Thread(Thread[HttpRequestHandler-86,5,main])--SELECT * FROM PROGRAM_SUB_CAT
[TopLink Fine]: 2006.09.22 06:31:50.015--ServerSession(989)--Connection(10332)--Thread(Thread[HttpRequestHandler-86,5,main])--SELECT PROGRAM_ID, CREATED_BY_USERID FROM (SELECT CREATED_BY_USERID, ROWNUM PROGRAM_ID FROM (SELECT DISTINCT(CREATED_BY_USERID) CREATED_BY_USERID, 1 AS PROGRAM_ID FROM PROGRAM))
(I only see my application specific queries after this... no exceptions or debug logs)... as I said before.. the application gives exception in the session bean at the time of commit, and there's no exception raised from Toplink code in DAO... -
How to use Optimistic Locking in Toplink
Hi!
Iam using Toplink for O/R mapping, and for each table
iam using one TimeStamp field, and i specified that
field as Locking filed, by using the Loking option, and checked the TimeStampLocking option.
Now my question is do i need to update the Timestamp filed
each time if i create a new record and while modify an existing record.
And also do i need to compare the Timestamp for the record which client as read previousley to the TimeStamp in the database for the record manullay lik
suppose t1 is the timeStamp, which i got from the client,
and t2 is the timestamp which i read from the Database.
Now my question is, is it necessary to compare the timestamp.Once optimistic locking has been configured TopLink will manage the updating and comparing of the OptimisticLocking value. There is no requirement for you to manage this value.
--Gordon -
Error in Update Process for optimistic locking
Hello,
I tried to create a tabular form according to this How-To:
http://www.oracle.com/technology/products/database/application_express/howtos/tabular_form.html
which worked fine until I tried to implement the optimistic locking.
I use the same update process:
declare
l_cks wwv_flow_global.vc_arr2;
j pls_integer := 1;
begin
-- Get original MD5 checksum
select wwv_flow_item.md5(job,mgr,hiredate,sal,comm,deptno) cks
BULK COLLECT INTO
l_cks
from emp;
-- Compare the original checksum, l_cks,
-- with submitted checksum, htmldb_application.g_fcs.
-- If they are different, raise an error.
for i in 1..l_cks.count
loop
if htmldb_application.g_fcs(i) != l_cks(i) then
rollback;
raise_application_error(
-20001,
'Current version of data in database has changed '||
'since user initiated update process.');
return;
end if;
end loop;
but as soon as I try to apply the changes in the update process I get an error message saying: PLS-00503: RETURN statement required for this return from function
So, if i delete the row with the "return;" statement, I get no error anymore, but when I test the optimistic locking I get an error as soon as I try to update a row in the first place.
What am I doing wrong?
Johnny
P.S. : I am using Apex 1.6Hi Ant, of course......here is the customized pl/sql block I use:
declare
l_cks wwv_flow_global.vc_arr2;
j pls_integer := 1;
begin
-- Get original MD5 checksum
select wwv_flow_item.md5(partition,desig) cks
BULK COLLECT INTO
l_cks
from UNITS;
-- Compare the original checksum, l_cks,
-- with submitted checksum, htmldb_application.g_fcs.
-- If they are different, raise an error.
for i in 1..l_cks.count
loop
if htmldb_application.g_fcs(i) != l_cks(i) then
rollback;
raise_application_error(-20001,'Current version of data in database has changed ' || 'since user initiated update process.');
-- return;
end if;
end loop;
-- update UNITS
for i in 1..htmldb_application.g_f08.count
loop
if htmldb_application.g_f08(i) is not null then
update UNITS
set report_id = :P2_REPORT_ID,
partition = htmldb_application.g_f10(i),
desig = htmldb_application.g_f11(i)
where unit_id = htmldb_application.g_f08(i);
else
if htmldb_application.g_f10(i) is not null then
insert into UNITS
(report_id,
partition,
desig)
values
(:P2_REPORT_ID,
htmldb_application.g_f10(i),
htmldb_application.g_f11(i));
end if;
end if;
end loop;
end;
Thanks
Johnny
Maybe you are looking for
-
How to restrict the excess quantity delivery from the delivery note ?
Dear All, As we know we make the delivery note with the reference of sales order so ordered quantity will be copied in the delivery note automatically. At the time of picking we can reduce the delivery quantity and make the partial delivery. But for
-
Yesterday I backed up all of my data with rsync to a USB thumb drive. Surprisingly it all fit, but my intentions were to wipe my disk and create a new partition scheme for a dualboot while still being able to continue where I left off with arch. So a
-
Can a query make use of an Index on concat column ?
Hi sql gurus, We will develope application on a database as below ( simplified ) : create table invoice (doc_no varchar2(30), cust_code varchar2(10), amount number (12,2)); create table debit_memo (doc_code varchar2(6), doc_no varchar2(24), cust_code
-
Issue when Opening a dwg file for conversion
"An unexpected error has occurred. PDFMaker quits silently when creating a PDF" is the error. The dwg has been created by Archicad 15. Dwg's created by other apps work ok. Is there some content I need to remove from the dwg? I can send the file if
-
Just updated everything but when I open iTunes all my drop down menus are gray and I can't selecte them. To close out iTunes I have to use command option esc and force quit because all drop down menus and shaded gray and I can't access them