Monday, April 1, 2019

Navigation dropdown on hover

W3.CSS

Navigation Bar with Dropdown

Add a dropdown menu inside the navigation bar:

tabs css

W3.CSS

Active Tabs

To highlight the current tab/page the user is on, add a color class, and use JavaScript to update the active link.

London

London is the capital city of England.

accordion css

W3.CSS

Accordions

An accordion is used to show (and hide) HTML content:

Section 1

Some text..

EntityManager example

public class CreateEmployee {

   public static void main( String[ ] args ) {
   
      EntityManagerFactory emfactory = Persistence.createEntityManagerFactory( "Eclipselink_JPA" );
      
      EntityManager entitymanager = emfactory.createEntityManager( );
      entitymanager.getTransaction( ).begin( );

      Employee employee = new Employee( ); 
      employee.setEid( 1201 );
      employee.setEname( "Gopal" );
      employee.setSalary( 40000 );
      employee.setDeg( "Technical Manager" );
      
      entitymanager.persist( employee );
      entitymanager.getTransaction( ).commit( );

      entitymanager.close( );
      emfactory.close( );
   }
}

Save or update in spring

CrudRepository save() to Add a New Instance

Let’s create a new instance of MerchandiseEntity and save it to the database using the InventoryRepository:
1
2
3
4
5
6
InventoryRepository repo = context
  .getBean(InventoryRepository.class);
MerchandiseEntity pants = new MerchandiseEntity(
  "Pair of Pants", BigDecimal.ONE);
pants = repo.save(pants);
Running this will create a new entry in the database table for MerchandiseEntity. Notice that we never specified an id. The instance is initially created with a null value for its id and when we call the save() method, an id is automatically generated.
The save() method returns the saved entity, including the updated id field.

CrudRepository save() to Update an Instance

We can use the same save() method to update an existing entry in our database. Suppose we had saved a MerchandiseEntity instance with a specific title:
1
2
3
MerchandiseEntity pants = new MerchandiseEntity(
  "Pair of Pants", 34.99);
pants = repo.save(pants);
But later we found that we wanted to update the price of the item. We could then simply get the entity from the database, make the change and use the save() method as before.
Assuming we know the id of the item (pantsId), we can use the CRUDRepositorymethod findById to get our entity from the database:
1
2
3
MerchandiseEntity pantsInDB = repo.findById(pantsId).get();
pantsInDB.setPrice(44.99);
repo.save(pantsInDB);
Here, we’ve updated our original entity with a new price and saved the changes back to the database.

 Conclusion

In this quick article, we’ve covered the use of CrudRepository‘s save() method. This method can be used to add a new entry into your database as well as updating an existing one.

Spring Tutorial

Spring Tutorial📕📕

spring framework tutorial
This spring tutorial provides in-depth concepts of Spring Framework with simplified examples. It was developed by Rod Johnson in 2003. Spring framework makes the easy development of JavaEE application.
It is helpful for beginners and experienced persons.

Thursday, June 29, 2017

1.2 Why Computer Intergration is needed ?


1.2
Why Computer Intergration is needed ?
The integration allows individual processes to exchange information with each other and initiate actions.