How to check whether entity has been persisted in the current transaction
Hello,
I am porting functionality which relay heavily on lifecycle of the entity.
For example methods like these:
* returns true if the instance has been modified, deleted or newly made
* persistent in the current transaction
public boolean isModified(final EntityObject entity)
public boolean isDeleted(final EntityObject entity)
For some of these callsI have found how to port them to toplink und just want to validate that this is the right way:
protected static UnitOfWork getUnitOfWork(EntityManager entityManager) {
return ((JpaEntityManager) (entityManager.getDelegate())).getUnitOfWork();
public static boolean isModified(EntityManager entityManager, Object entity) {
UnitOfWorkChangeSet set = getUnitOfWork(entityManager).getCurrentChanges();
ObjectChangeSet oset = set.getObjectChangeSetForClone(entity);
return !oset.getChanges().isEmpty() || oset.isNew();
public static boolean isDeleted(EntityManager entityManager, Object entity) {
UnitOfWorkChangeSet set = getUnitOfWork(entityManager).getCurrentChanges();
return set.getDeletedObjects().keySet().contains(entity);
but I did not find how to do following with the eclipselink:
* returns true, if the given entity object has been persistet during the
* current transaction
* @param entity
* @return true, if the given entity object has been persistet during the
* current transaction
public boolean isPersistent(final EntityObject entity)
Questions:
- how can I check whether the entity is persistent in the sense already stored in the DB ?
- how can I check whether the entity has been persisted in the current transaction ?
Thanks in advance.
Andre Teshler
Hi Andre,
In Eclipse link there are Entity listeners which will define the life cycle events like preInsert(),postInsert() etc.On successful insertion of an object its postInsert() life cycle method gets called.If you have to validate whether object inserted successfully then best place is to override the postInsert() and check for the existence of the record.All the event life cycle methods take a DescriptorEvent as parameter which will give handle to API as given below.In the same method you can check if this insert operation succeeded in the same transaction.
package model;
import java.util.Vector;
import org.eclipse.persistence.descriptors.DescriptorEvent;
import org.eclipse.persistence.descriptors.DescriptorEventAdapter;
import org.eclipse.persistence.descriptors.DescriptorEventListener;
import org.eclipse.persistence.internal.sessions.ObjectChangeSet;
public class SampleEntityLIstener extends DescriptorEventAdapter {
public SampleEntityLIstener() {
super();
public void postInsert(DescriptorEvent event) {
event.getRecord().containsKey("pass the object");
event.getChangeSet().getUOWChangeSet();
public void preInsert(DescriptorEvent event) {
Once you implement the DescriptorEventListener,need to register with the Entity so that life cycle methods gets called and respective business logic gets executed.
Hope this helps,
Regards,
P.Vinay Kumar
Similar Messages
-
How to check whether campaign has been uploaded to online server
Hi,
How to check whether campaign has been uploaded to online server by using SQL analyzer
Thanks,
RasheedHi Rasheed,
To quickly check if the campaign has been uploaded from MSA to the server, you can check the TR_STATUS column on the SMOPCCAMPN table for your campaign, if the value is P000 or P*** then it has been uploaded to the server and is waiting for confirmation, if the status is O, it has been uploaded and created in the server.
Best Regards,
Ankan -
An Invalid Setup has been detected for the current Transaction Type in AME
Gurus,
I am constantly getting an error An Invalid Setup has been detected for the current Transaction Type in Approvals Management
My client have 3 units say A,B,C. A requirement is such that whenever a vacancy is created, an approval should be sought from units HR manager.
I have created a dynamic query for this and it is working fine for first two units say A & B. i.e. whenever somebody from unit A or B creates a vacancy it is correctly fetching the
respective units managers. But, this whole AME is not working for unit C. An error pops out which says *An Invalid Setup has been detected for the current Transaction Type in
Approvals Management* . Can anybody tell me what can be the issue?
Edited by: 919527 on Aug 8, 2012 12:40 AM
Edited by: 919527 on Aug 8, 2012 12:41 AMSolved it. The cursor wsa fetching two rows in plcae of one.
-
How to see whether GR has been done on PO or Inbound Delivery
Hi Gurus
How to know whether GR has been done on PO or inbound delivery. Is there any report or tables through that we can see this.
Regards
IrfanHi
If you check the material document posted for GR it should specify
If the GR is done with respect to Inbound delivery then the inbound delivery number will be in material document if I remember it correctly.
Please check and advice
Deepak -
I have edited the default edit form for my Issue Tracking Tool using Info Path, But currently when I try accessing the form using IE 10 64x , I got the following error-
“The form cannot be displayed in the browser because the use of DOM storage has been disabled in the current browser settings. In order to load the form, DOM storage must be allowed.”
But using Firefox I was able to access the edit form , so can anyone advice on this please?
Thanks. Tools > Internet Options > Privacy Tab > Advanced
Check the over-ride box to Enable/Accept cookies. Click on Always allow session
cookies.
2. Clear Your Cache and Cookie Files
If you are using an Internet Explorer browser, please follow these instructions to clear
your cache and cookie files: Open your Internet Explorer browser.
Tools > Internet Options > General > Browsing History
Click Delete Browsing History.
Delete Temporary Internet Files, Cookies and History Also under Browsing History,
click Settings and make sure that your browser automatically checks for newer versions
of stored pages. Click OK and restart your browser
3. Pop-up Blockers
Turn Off the firewall in IE.
you can disable\enable it from below:
http://webdevwonders.com/clear-dom-storage/
Clear DOM Storage in Firefox:
Select “Tools” -> “Clear Recent History”, open “Details”, check “Cookies” and select “Everything” as time range.
ATTENTION: No other time range will clear the DOM Storage. Have a look at
Mozillas documentation for further info.
Disable DOM Storage in Firefox:
Type “about:config” in your address bar and hit enter to view your internal browser settings. Scroll down to „dom.storage.enabled“, right click on it and hit „Toggle“ to disable the DOM Storage.
Clear DOM Storage in Internet Explorer:
Select “Tools” -> “Internet Options” -> “General” -> check “Delete browsing history on exit”, click on “Delete”, check “Cookies”, click on “Delete” once more and restart your browser afterwards.
Disable DOM Storage in Internet Explorer:
Select “Extras” -> “Internet Options” -> “Advanced” Tab -> Go to “Security” -> uncheck “Enable DOM-Storage”
Clear DOM Storage in Chrome:
Select “Tools” -> “Clear browsing data…”, check “Delete cookies and other site data”, select “Everything” from “Clear data from this period” and click on “Clear browsing data”.
Disable DOM Storage in Chrome:
Open “Options” and select “Under the Hood” Tab. Click on “Content settings…”, select “Cookies” and set “Block sites from setting any data”.
If this helped you resolve your issue, please mark it Answered
ok i did all these steps but still i am getting the same error,, i can not understand how SharePoint works better on firefox and chrome comparing to IE !!! so what i should do now , as all the edit forms that are customized using Info path can not be viewed
on IE 10 64x !!!! -
How to check what software has been installed
In System Preferences the Software Update no longer has an "Installed Updates" option. How do you check for these updates?
Thanks
RonIn the System Information application (Utilities folder) you can see a complete list of installations in the Software/Installations category.
-
How to check whether music has finished playing and go to another frame
I have a bunch of music samples which are set up to play on
the click of a button, and at the same time go to another frame in
the movie clip so it says 'playing', with a stop button that takes
you back to frame 1. If you don't click stop, though, when the song
ends, it stays on this second frame, even though there is nothing
playing anymore, which is a bit confusing for the viewer.
So I need to tell flash to check whether the song is finished
playing, and then if it is, go back to frame 1. I have no idea how
to do this; have basically done it all using tutorial and samples
and my limited actionscript knowledge, but I can't find this
particular code, and don't really have any idea how to write it
from scratch.
Many thanks!
Here's my first frame actionscript:
stop();
this.createEmptyMovieClip ("mcSoundHolder",
this.getNextHighestDepth());
var mySound:Sound = new Sound (mcSoundHolder);
btn_Song1.onRelease = function():Void {
stopAllSounds();
mySound.loadSound("Soaring1-Burlesque.mp3", true);
gotoAndPlay("Song1");
btn_Song2.onRelease = function():Void {
stopAllSounds();
mySound.loadSound("Soaring2-PopCyclePotpourri.mp3", true);
gotoAndPlay("Song2");
btn_Song3.onRelease = function():Void {
stopAllSounds();
mySound.loadSound("Soaring3-PopCycle-SongofLight.mp3",
true);
gotoAndPlay("Song3");
and so on...I am not sure how Tomcat handles this, but you need to use two-way (mutual authentication) request but not enforce SSL between Tomcat and the client browser. This will make the browser prompt the user for the cert they want to send. Then you'll need to tackle the other part of your problem, getting the correct content displayed depending on whether the user sent a cert or not. I'm even less help there than I was on the first part of your question.
So, yeah - good luck with that
Lee -
How to check whether a file is present in the UNIX directory of app. server
Hi,
I am creating files in the UNIX directory in the application server using :
CONCATENATE '/sapmnt/RD1/interfaces/client670/'
p_fname '.CSV' INTO w_filename.
OPEN DATASET w_filename FOR OUTPUT IN TEXT MODE.
LOOP AT t_output1.
TRANSFER t_output1 TO w_filename.
ENDLOOP.
CLOSE DATASET w_filename.
I am unable to check whether a file with the same name exists or not. How to check the duplicate state of the file.You can use the following fm
RZL_READ_FILE
or
use OPEN DATASET FOR INPUT. -
How to identify which data has been inserted to the table in specific date
Hi,
i created one table without data column.. i am inserting data in that table.
i want which data has been inserted today..
Please help.
Thanks,If you are in Oracle 10g you can use ORA_ROWSCN.Note that unless the table was created with ROWDEPENDENCIES enabled, though, ORA_ROWSCN is tracked at the block level rather than the row level. So a block with one new row and many old rows could appear as having all been entered today.
Justin -
Hi.. When do you xactly get this error message?Are you trying to boot your computer using a cd?Are you trying to load another operating system? Secure Boot is a feature designed to prevent malicious software and unauthorized media from loading during the boot process. This option is enabled by default, but can be turned off in UEFI / BIOS. Select your Windows 8 device and use the following steps to change the Secure Boot setting:Completely shut down the computer.Power on the system. As soon as the first logo screen appears, immediately press F2 to enter the BIOS.Use the right arrow key to select Security.Use the down arrow key to highlight Set Supervisor Password and press Enter.Create a password and press Enter. Retype the password to confirm and press Enter again.Use the right arrow key to select Boot.Press the down arrow key to select Secure Boot and press Enter.With the arrow key, highlight Disabled and press Enter.Press the F10 key and select Yes to save the changes and exit the BIOSWe suggest removing the supervisor password immediately after enabling Secure Boot. If you choose not to remove your supervisor password, make sure you write it down for future use.
I fixed this issue when I realised I had set a passoword many months ago when I was in Windows 8.1 If you found that your BIOS is locked, use a password you've used for other 'important' things. Cheers, Dave I have an Acer Aspire E1-571 I'm having the same problem - however when I press F2 it goes to a blue security box saying: Enter Current Password: I don't have a password. It was set by the factory, I bought it new. How do I get around this. The last hard drive is trapped - I can't fix it, even with Microsoft's chat help when they accessed my computer remotely.I bought a new hard drive, and have the Windows 7 Professional DVD in the drive - but it can't access it under the current Security Settings - only to find it has a Password - thus my visit to this forum today. Any help you can offer would be gratefully accepted.
-
How to set selected entity of a collection in the current, and publish it.
Hi frnds,
I have collection which contains n number of entities,
now i am filtering the collection and getting a unique entity.
what i need is that i want to publish this entity as current.
How can I set this filtered entity to the current?
regards
Ashraf.Hi Ashraf,
You have to iterate the collection using the following methods first till you access the entity to which you want to change the
focus.
IF_BOL_BO_COL~GET_FIRST
IF_BOL_BO_COL~GET_NEXT
IF_BOL_BO_COL~GET_PREVIOUS
IF_BOL_BO_COL~GET_LAST
Once you reach the corresponding entity, the following method will give that entity when called.
IF_BOL_BO_COL~GET_CURRENT
Then you have to call the following method to publish this focus.
IF_BOL_BO_COL~PUBLISH_CURRENT
If you have already iterated to the unique entity in the collection, then you just need to do the publish_current.
Regards,
Leon -
How to verify whether backup has been physically copied to tape ?
I have installed OSB and have a tape library. After backing up to the tape, I am able to see successfully backed up message. However is there any other way to confirm the backup really exists on the tape ?
Regards,
SandeepDo a test restore of the data to another folder or another machine? When we install a new environment we always do a test restore to ensure it is working. In the past we have uncovered drive firmware problems with encryption where the backup would work fine but the restore would always fail and the manufacturer had to fix it in the drive firmware. Always best to test.
Thanks
Rich -
My computer and itunes recognizes my phone, but itunes says that the phone cannot be used because it requires 11.1 or later.
I have 11.1. I have tried restart, shut down, different cables.. HELP!!On your computer, launch iTunes, then: iTunes>About>Version...what does it say?
-
An Invalid Setup has been detected for the cur..For PO Approval AME -R1211
Hi Friends,
I am using R12.1.1
I set up AME for Purchase Order Approval and when i run Test Workbench I am getting the following error:
An Invalid Setup has been detected for the current Transaction Type in Approvals Management.Please contact your system administrator.
My sertup uis correct? so whta's cauising this issue? is it a Bug?
Regards,
DBPlease see these docs.
An Invalid Setup has been detected for the current Transaction Type in Approvals Management. [ID 602920.1]
Leave Of Absence Approval Failing With - An Invalid Setup Has Been Detected For The Current Transaction Type In Approvals Management [ID 437835.1]
Invalid Setup Has Been Detected For The Current Transaction Type In Approvals Management [ID 1313961.1]
An Invalid setup has been detected for the current transaction type [ID 1300417.1]
Connect By Loop Problem in Supervisor Hierarchy [ID 579750.1]
When Submitting Competence Profile With Approval Off Warning Message Received [ID 759245.1]
Absence Mgmt Not Initiating HR Workflow Giving AME Errors [ID 852867.1]
Initiating A Transaction That Goes For Approval Fails With ORA-06502 [ID 795063.1]
Thanks,
Hussein -
Cycle counting - How many times an item has been counted?
Hallo Gurus,
do you know if there's a way to know how many times an item has been counted during the year?
Thank you very much indeed.
MickHi Mick,
Check the below links. Hope they will help you.
http://help.sap.com/saphelp_snc70/helpdata/EN/4c/c1b4b55b912a4ae10000000a42189b/content.htm
http://help.sap.com/saphelp_46c/helpdata/en/4d/2b8e3d43ad11d189410000e829fbbd/content.htm
Regards,
Shilpa
Maybe you are looking for
-
Why my iphone's iMessage and Facetime can't be activated?
hi, I just bought an iphone4 from the Mississauga apple store two days ago, the iMessage and Facetime can't be activated, so these things are what I tried: (my SIM card matches with my iphone, have a valid carrier, and I paid my bill and have a valid
-
Error While Debugging the Application
Hello, I am developing applications using WebDynpro for JAVA. I am using NWDI 7.0. I am getting an error while debugging the application. When I click on debug mode in debug perspective, I am getting error message as : "Failed to connect to remote V
-
Impossible to Access to Transformation of Cube, after it was modified
Hi, I've a problem... I added two key figures on my existent Cube. After it, I've modified transformation of the cube for one of this new key figures... I saved transformation and now I can't access to this transformation in Modify, when I try to mod
-
Do ALL early Zen Xtras have faulty earphone socke
<SPAN class=postbody>Am thinking of buying a second-hand Zen Xtra, and just wondered if the faulty earphone socket is something that affected ALL early Zen Xtras? (I.e. the ones without the cutout window in the leather case.) Or are there many early
-
Hello Gents and Ladies. i just bought my slightly used macbook pro.Previous owner did not entirely delete his profile, my question is how do i completely delete old user profile? i deleted the old user and set a new profile in but for some reason und