<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Adya Shukla</title>
    <description>The latest articles on Forem by Adya Shukla (@adyashuks).</description>
    <link>https://forem.com/adyashuks</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F434093%2Ffbf6a22b-4c9a-4342-a9e5-ef6469534ce4.jpg</url>
      <title>Forem: Adya Shukla</title>
      <link>https://forem.com/adyashuks</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/adyashuks"/>
    <language>en</language>
    <item>
      <title>Big Word : Multi Tenancy</title>
      <dc:creator>Adya Shukla</dc:creator>
      <pubDate>Sun, 30 Aug 2020 14:21:39 +0000</pubDate>
      <link>https://forem.com/adyashuks/big-word-multi-tenancy-5ggl</link>
      <guid>https://forem.com/adyashuks/big-word-multi-tenancy-5ggl</guid>
      <description>&lt;p&gt;What is Multi Tenancy ?&lt;br&gt;
It sounds like a big big word but its explanation is quite simple.&lt;br&gt;
SO what it is !!!&lt;br&gt;
According to wikipedia,&lt;br&gt;
"The term "software multitenancy" refers to a software architecture in which a single instance of software runs on a server and serves multiple tenants. Systems designed in such manner are often called shared (in contrast to &lt;strong&gt;dedicated&lt;/strong&gt; or &lt;strong&gt;isolated&lt;/strong&gt;)."&lt;br&gt;
Simply said it is a software architecture pattern where a single application is shared by multiple customers and they own separate databases.&lt;/p&gt;

&lt;p&gt;It is quite common for many businesses to use Single Tenant approach. So what is that?&lt;br&gt;
In simple words, Single Tenancy is where a single application has a single customer.&lt;/p&gt;

&lt;p&gt;Now comes the point what does multi tenancy provides us that single tenancy does not and vice versa :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Multi tenancy reduces the cost&lt;/li&gt;
&lt;li&gt;Adding new customers becomes easy&lt;/li&gt;
&lt;li&gt;Maintaining the same application becomes easier&lt;/li&gt;
&lt;li&gt;Also it maximizes resource usage&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;On the other hand,&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Single tenancy provides an option for customization where in single tenants can customize their app according to their needs.&lt;/li&gt;
&lt;li&gt;Single tenants can decide what option or update to they want for their product.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Obviously there is no preference guideline to choose between the two as it truly depends on the requirement.&lt;br&gt;
The goal of this small article was to make familiar with both the options we have.&lt;br&gt;
Hope it helps !&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>design</category>
      <category>be</category>
    </item>
    <item>
      <title>Overview of Queries type in Spring Data JPA</title>
      <dc:creator>Adya Shukla</dc:creator>
      <pubDate>Wed, 26 Aug 2020 02:13:43 +0000</pubDate>
      <link>https://forem.com/adyashuks/overview-of-queries-type-in-spring-data-jpa-5a95</link>
      <guid>https://forem.com/adyashuks/overview-of-queries-type-in-spring-data-jpa-5a95</guid>
      <description>&lt;p&gt;This post deals with types of JPA query available. JPA queries are of 3 types mainly :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Query&lt;/li&gt;
&lt;li&gt;NativeQuery&lt;/li&gt;
&lt;li&gt;CriteriaQuery&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;1 &lt;strong&gt;Query&lt;/strong&gt;: It is written in Java Persistence Query Language (JPQL) syntax and used to perform Crud operations. &lt;br&gt;
&lt;strong&gt;Query query = getEntityManager().createQuery("SELECT m FROM MenuEntity m WHERE m.id=:id");&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are two subtypes of query as well :&lt;br&gt;
TypedQuery&lt;br&gt;
NamedQuery &lt;/p&gt;

&lt;p&gt;a . &lt;strong&gt;TypedQuery&lt;/strong&gt; : JPA can't infer what query result type will be and thus we have to cast the type. JPA provides a special Query sub-type known as a TypedQuery. This is always preferred to use if we know our Query result type beforehand.&lt;/p&gt;

&lt;p&gt;TypedQuery&amp;lt;&lt;strong&gt;Menu&lt;/strong&gt;&amp;gt; query&lt;br&gt;
      = getEntityManager().createQuery("SELECT m FROM Menu m WHERE m.id=:id", Menu.class); **&lt;br&gt;
In above query we can see Menu type assigned to TypedQuery.&lt;/p&gt;

&lt;p&gt;b. &lt;strong&gt;NamedQuery&lt;/strong&gt; : We provide NamedQuery to entity class, which gives a quick way to read Entity related queries. All NamedQueries must have a unique name. If there is a single NamedQuery then we can use @NamedQuery on the entity class, but if there are multiple then we use @NamedQueries and add comma separated @NamedQuery in it.&lt;/p&gt;

&lt;p&gt;For example :&lt;br&gt;
&lt;strong&gt;@Entity&lt;br&gt;
@NamedQuery(name="Menu.findAll", query="SELECT m FROM Menu m") &lt;br&gt;
public class Menu {&lt;br&gt;
  ...&lt;br&gt;
}&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;2 .&lt;strong&gt;NativeQuery&lt;/strong&gt; : NativeQuery is very simple to use as it provide provides flexibility to write queries that are not provided by JPQL syntax.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Select m from Menu m&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;3 .&lt;strong&gt;CriteriaQuery&lt;/strong&gt; : Criteria queries are  mainly useful to build dynamic queries whose exact structure is only known at runtime.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CriteriaBuilder cb = em.getCriteriaBuilder();&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;CriteriaQuery q = cb.createQuery(Menu.class);&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Root c = q.from(Menu.class);&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;q.select(c);&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is the difference between using JPQL and Criteria Queries?&lt;/strong&gt;&lt;br&gt;
JPQL queries are defined as simple strings similar to SQL queries, but criteria queries are defined by creating Java objects that represents query elements.&lt;br&gt;
Whenever we have to build dynamic queries then criteria queries are preferred else its good to use JPQL for simple queries.&lt;br&gt;
Also when we use criteria queries then we can detect errors at compile time itself.&lt;/p&gt;

</description>
      <category>java</category>
      <category>database</category>
    </item>
    <item>
      <title>Docker Basics</title>
      <dc:creator>Adya Shukla</dc:creator>
      <pubDate>Sun, 23 Aug 2020 12:16:30 +0000</pubDate>
      <link>https://forem.com/adyashuks/docker-basics-386c</link>
      <guid>https://forem.com/adyashuks/docker-basics-386c</guid>
      <description>&lt;p&gt;As a newbie the first question that comes to mind is What is Docker ?&lt;br&gt;
So, A docker is a command line program, a background daemon and set of remote services that simplifies installation, running, publishing or removing software.&lt;/p&gt;

&lt;p&gt;Docker is NOT virtualization.&lt;/p&gt;

&lt;p&gt;Running docker means running two programs : docker CLI and docker daemon.&lt;br&gt;
Docker containers are isolated with 8 aspects:&lt;br&gt;
1 . PID namespace : process identifiers and capabilities&lt;br&gt;
2 . UTS namespace : host and domain space&lt;br&gt;
3 . MNT namespace : File system access and structure&lt;br&gt;
4 . IPC namespace : Process communication over shared memory&lt;br&gt;
5 . NET namespace : Network access and structure&lt;br&gt;
6 . USR namespace : User name and identifiers&lt;br&gt;
7 . chroot() : controls location of file system root&lt;br&gt;
8 . cgroups : Resource protection&lt;/p&gt;

&lt;p&gt;What are Images ?&lt;br&gt;
A bundled snapshot of all the files that should be available to a program running inside a container.&lt;/p&gt;

&lt;p&gt;What is container ?&lt;br&gt;
It is a running or stopped instance of some image.&lt;/p&gt;

&lt;p&gt;We can create as many container from an image but containers that are created from same image don't share changes to their file systems.&lt;br&gt;
Here are few basic commands to run :&lt;/p&gt;

&lt;p&gt;1 . docker run hello-world&lt;br&gt;
You will get output as :&lt;br&gt;
&lt;strong&gt;Hello from Docker!&lt;br&gt;
This message shows that your installation appears to be working correctly.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;2 . &lt;strong&gt;docker run --detach --name web nginx : latest&lt;/strong&gt;&lt;br&gt;
 or &lt;br&gt;
&lt;strong&gt;docker run -d --name web nginx : latest&lt;/strong&gt;&lt;br&gt;
where -d or --detach  will start the program in background&lt;/p&gt;

&lt;p&gt;3 . To check currently running containers : &lt;br&gt;
&lt;strong&gt;docker ps&lt;/strong&gt;&lt;br&gt;
This will only display running containers but if you want to see all including those in exited state then :&lt;br&gt;
&lt;strong&gt;docker ps -a&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;4 . To check docker logs :&lt;br&gt;
&lt;strong&gt;docker logs&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;5 . To continue watching logs :&lt;br&gt;
&lt;strong&gt;docker logs --follow&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These are few very basics of the docker. Hope it helps !!!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
