Sunday, 27 December 2015

JBO-25013: Too many objects match the primary key null

JBO-25013: Too many objects match the primary key null

i Encountered This Error while i was trying to change an attribute in the selected row (selected by the user on the screen), and there was an Alternative Key on that iterator view/entity, setting/changing that attribute i wanted to change would make that Alternative Key repeat, which triggered that error, after removing that Alternative Key, the error no longer appeared and there was no error.
so just remove the Alternative Key and try again, it should work smoothly.

source: i got it from this topic ( the last answer by the person who asked this question )

Monday, 13 April 2015

How to generate a random password in Java ?

Today i was looking for a way to make a random generated password, and i made some search and the best thing i found was the method below. 




if you want to generate a random password (for forgot password scenario, and email this random password to the user), use the following class RandomStringUtils  


this is the code to generate the password, 

RandomStringUtils.randomAlphanumeric(20).toUpperCase();
20 = number of random chars in the generated password, 
you can change this number based on how many chars you want 
in your random generated password.
but you have to add the library that contains the RandomStringUtils class to the project you are working on to be able to import it, the libraries that contain this class are called (JRF Client, JAX-RS Jersey Jackson (Bundled))

Source:

http://stackoverflow.com/questions/41107/how-to-generate-a-random-alpha-numeric-string

Thursday, 26 March 2015

How to disable RichInputText in an ADF page programmatically

Hi, it is Mostafa Amine here, this is my First blog Ever, i always wanted to blog but i never had or made time for that, so here i am writing my First Blog entry Ever, hope it will be Helpful to Everyone who reads it or stumbles upon it :)






so a few days ago i wanted to disable a RichInputText and a RichCommandToolbarButton programmatically from a Managed bean, all i could find on the internet was CSS and JQuery solutions, so here is a solution for those who donot want to go through CSS and JQuery or who are using page Fragments (.jsff) like me




to disable components like (RichInputText , RichCommandToolbarButton  or RichSelectBooleanCheckbox), you can bind that component that you want to disable programmatically and then make a new  (RichInputText , RichCommandToolbarButton  or RichSelectBooleanCheckbox) based on your scenario, then set the property disabled  of this component to True and then assign your component (that you want to disable) to that newly created disabled component, below is the code of how to do so



        RichInputText newInputText= new RichInputText();

        newInputText.setDisabled(true);
       set<YourInputTextName>(newInputText);


      RichSelectBooleanCheckbox newChckBox = new RichSelectBooleanCheckbox();

      newChckBox .setDisabled(true);
     set<YourChckBoxName>(newChckBox );




     RichCommandToolbarButton newCmdBttn= new   RichCommandToolbarButton();

     newCmdBttn.setDisabled(true);
     set<YourCmdBttnName>(newCmdBttn);



you might ask, why would not you just set the binding's disabled property directly instead of making a new UI component n setting its disabled property, i found that this method doesnot always work, specially if you want to disable/enable your component in the constructor if your bean, you have to use this method.