<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rutul Raval on Medium]]></title>
        <description><![CDATA[Stories by Rutul Raval on Medium]]></description>
        <link>https://medium.com/@sankybhano?source=rss-52fb89de9e74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vNcZ5FmwQojtX6YH</url>
            <title>Stories by Rutul Raval on Medium</title>
            <link>https://medium.com/@sankybhano?source=rss-52fb89de9e74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 04:58:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sankybhano/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ How to Manually Install and Run uiautomationviewer with New Android SDK (2024+)]]></title>
            <link>https://medium.com/@sankybhano/how-to-manually-install-and-run-uiautomationviewer-with-new-android-sdk-2024-b81ba64f589f?source=rss-52fb89de9e74------2</link>
            <guid isPermaLink="false">https://medium.com/p/b81ba64f589f</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android-app-testing]]></category>
            <dc:creator><![CDATA[Rutul Raval]]></dc:creator>
            <pubDate>Thu, 19 Jun 2025 09:41:50 GMT</pubDate>
            <atom:updated>2025-06-19T10:04:13.114Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Installation and Running of uiautomationviewer with New Android SDK (2024+)</em></strong></p><p>Google has deprecated and unbundled some of the older utilities like uiautomationviewer from recent distributions of Android SDK. The utility is still extremely useful for UI element inspection in Android applications, especially while doing test automation using Appium or Espresso.</p><p>Below is a step-by-step guide to hand-installing it, installing Java 8, and troubleshoot common issues.</p><p><strong>Step 1: Download Legacy Android Tools (in order to Get uiautomationviewer)<br></strong>New Android SDKs (installed via cmdline-tools) don’t include older tools like uiautomationviewer. You’ll have to install the package of legacy tools manually:</p><p><strong>✅ Prerequisites:</strong><br>Make sure you’ve set your ANDROID_HOME system variable correctly.</p><p>Example:<br>ANDROID_HOME=C:\\\\Users\\\\&lt;your-username&gt;\\\\Downloads\\\\softwares\\\\Android SDK</p><p>▶ Run the following command in CMD to install legacy tools:<br>sdkmanager.bat — install “tools”<br>This will download other tools like uiautomationviewer.bat, monkeyrunner, lint, etc., to tools/bin.</p><p><strong>Step 2: Find uiautomationviewer.bat</strong><br>After you install it, go to the following path:<br>&lt;Your Android SDK Folder&gt;\\tools\\bin\</p><p>You should see uiautomationviewer.bat now.</p><p><strong>⚠️ Step 3: Fix Java 8 Compatibility</strong><br>If you try running the .bat file directly, you might get the following errors:<br>Error: Could not create the Java Virtual Machine.<br>Error: A fatal exception has occurred. Program will exit.<br>That’s because uiautomationviewer only supports Java 8.</p><p><strong>✅ Solution:</strong><br>Fix JAVA_HOME to your Java 8 directory (not a newer JDK):<br>JAVA_HOME = C:\Program Files\Java\jdk1.8.x</p><p><strong>Step 4: Configure Required Environment Variables</strong><br>In your User Environment Variables, add the following to Path:<br>%JAVA_HOME%\\bin<br>%ANDROID_HOME%\\tools<br>%ANDROID_HOME%\\tools\\bin<br>%ANDROID_HOME%\\cmdline-tools\\latest\\bin<br>This makes SDK tools and appropriate Java version available in your terminal.</p><p><strong>Step 5: Run the Tool</strong><br>After all the above steps:</p><p>Open CMD from the tools\\bin directory.</p><p><strong>Run:</strong><br>uiautomationviewer.bat<br>You must now see the UI Automator Viewer interface opening successfully.</p><p><strong>Final Result</strong><br>You will have an open uiautomationviewer window from where you can observe and examine Android app UI elements based on screenshots captured from a connected device.</p><p><strong>Tips:</strong><br>In case you ever go back to Java 11+ for other tools, don’t forget to revert your JAVA_HOME.</p><p>You can create a shortcut batch file in case you need to toggle between JDKs.</p><p>=============================================================</p><p>Process summarized in screenshots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*clI5Y1uQXg0d3UlKEh-UNA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xRxdAVZyquI7e_VsxYIpqA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SHxBV7b1_8V-pujB3NGiUw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b81ba64f589f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hibernate second level caching: Problems with dependencies and versions]]></title>
            <link>https://medium.com/@sankybhano/hibernate-second-level-caching-problems-with-dependencies-and-versions-5becb0e6ec17?source=rss-52fb89de9e74------2</link>
            <guid isPermaLink="false">https://medium.com/p/5becb0e6ec17</guid>
            <category><![CDATA[cache]]></category>
            <category><![CDATA[hibernate-tutorial]]></category>
            <dc:creator><![CDATA[Rutul Raval]]></dc:creator>
            <pubDate>Sun, 11 May 2025 15:34:04 GMT</pubDate>
            <atom:updated>2025-05-11T15:36:25.092Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Hibernate second level caching tutorial" src="https://cdn-images-1.medium.com/max/382/0*TjJ5F40g-3IGIT4I.jpg" /></figure><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;<br>&lt;!DOCTYPE hibernate-configuration PUBLIC<br>        &quot;-//Hibernate/Hibernate Configuration DTD 3.0//EN&quot;<br>        &quot;http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd&quot;&gt;<br>&lt;hibernate-configuration&gt;<br>    &lt;session-factory&gt;<br>        &lt;!-- Database Connection Settings --&gt;<br>        &lt;property name=&quot;hibernate.connection.driver_class&quot;&gt;com.mysql.cj.jdbc.Driver&lt;/property&gt;<br>        &lt;property name=&quot;hibernate.connection.url&quot;&gt;jdbc:mysql://localhost:3306/hibernatedb&lt;/property&gt;<br>        &lt;property name=&quot;hibernate.connection.username&quot;&gt;root&lt;/property&gt;<br>        &lt;property name=&quot;hibernate.connection.password&quot;&gt;password&lt;/property&gt;<br>        &lt;!-- Hibernate Properties --&gt;<br>        &lt;property name=&quot;hibernate.dialect&quot;&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;<br>        &lt;!-- Hibernate creates a table if not there, otherwise updates that table--&gt;<br>        &lt;property name=&quot;hibernate.hbm2ddl.auto&quot;&gt;update&lt;/property&gt;<br>        &lt;property name=&quot;show_sql&quot;&gt;true&lt;/property&gt;<br>        &lt;property name=&quot;hibernate.cache.use_second_level_cache&quot;&gt;true&lt;/property&gt;<br>        &lt;!-- Cache provider configuration --&gt;<br>        &lt;property name=&quot;hibernate.cache.region.factory_class&quot;&gt;org.hibernate.cache.jcache.JCacheRegionFactory&lt;/property&gt;<br><br>&lt;!--        &lt;property name=&quot;hibernate.cache.region.factory_class&quot;&gt;org.hibernate.cache.internal.StrategyCreatorRegionFactoryImpl&lt;/property&gt;--&gt;<br>        &lt;property name=&quot;hibernate.javax.cache.provider&quot;&gt;org.ehcache.jsr107.EhcacheCachingProvider&lt;/property&gt;<br>        &lt;!--        &lt;property name=&quot;format_sql&quot;&gt;true&lt;/property&gt;--&gt;<br>        &lt;!-- Mapping Entity --&gt;<br>        &lt;mapping class=&quot;hibernateApp.Alien&quot;/&gt;<br><br>    &lt;/session-factory&gt;<br>&lt;/hibernate-configuration&gt;</pre><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;<br>         xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>         xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;<br>    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;<br><br>    &lt;groupId&gt;org.example&lt;/groupId&gt;<br>    &lt;artifactId&gt;HibernateVid45&lt;/artifactId&gt;<br>    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;<br><br>    &lt;properties&gt;<br>        &lt;maven.compiler.source&gt;22&lt;/maven.compiler.source&gt;<br>        &lt;maven.compiler.target&gt;22&lt;/maven.compiler.target&gt;<br>        &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;<br>    &lt;/properties&gt;<br>    &lt;dependencies&gt;<br>        &lt;!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core --&gt;<br>        &lt;!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-core --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.hibernate.orm&lt;/groupId&gt;<br>            &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;<br>            &lt;version&gt;6.6.13.Final&lt;/version&gt;<br>        &lt;/dependency&gt;<br>        &lt;!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.mysql&lt;/groupId&gt;<br>            &lt;artifactId&gt;mysql-connector-j&lt;/artifactId&gt;<br>            &lt;version&gt;9.3.0&lt;/version&gt;<br>        &lt;/dependency&gt;<br>        &lt;!-- https://mvnrepository.com/artifact/org.ehcache/ehcache --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.ehcache&lt;/groupId&gt;<br>            &lt;artifactId&gt;ehcache&lt;/artifactId&gt;<br>            &lt;version&gt;3.10.8&lt;/version&gt;<br>        &lt;/dependency&gt;<br>        &lt;!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-ehcache --&gt;<br>&lt;!--        &lt;dependency&gt;--&gt;<br>&lt;!--            &lt;groupId&gt;org.hibernate.orm&lt;/groupId&gt;--&gt;<br>&lt;!--            &lt;artifactId&gt;hibernate-ehcache&lt;/artifactId&gt;--&gt;<br>&lt;!--            &lt;version&gt;6.0.0.Alpha7&lt;/version&gt;--&gt;<br>&lt;!--        &lt;/dependency&gt;--&gt;<br>        &lt;!-- https://mvnrepository.com/artifact/org.hibernate.orm/hibernate-jcache --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.hibernate.orm&lt;/groupId&gt;<br>            &lt;artifactId&gt;hibernate-jcache&lt;/artifactId&gt;<br>            &lt;version&gt;6.6.13.Final&lt;/version&gt;<br>        &lt;/dependency&gt;<br><br>        &lt;!-- https://mvnrepository.com/artifact/javax.cache/cache-api --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;javax.cache&lt;/groupId&gt;<br>            &lt;artifactId&gt;cache-api&lt;/artifactId&gt;<br>            &lt;version&gt;1.1.1&lt;/version&gt;<br>        &lt;/dependency&gt;<br>    &lt;/dependencies&gt;<br><br>&lt;/project&gt;</pre><pre>package hibernateApp;<br>import org.hibernate.Session;<br>import org.hibernate.SessionFactory;<br>import org.hibernate.cfg.Configuration;<br>public class App {<br>    public static void main(String[] args) {<br>        // 1. Load configuration and build SessionFactory<br>        SessionFactory factory = new Configuration().<br>                configure(&quot;hibernate-Alien.cfg.xml&quot;).<br>                buildSessionFactory();<br><br>        // 2. Open a session<br>        Session session = factory.openSession();<br>        Session session2 = factory.openSession();<br><br>        // 3. Begin transaction<br>        session.beginTransaction();<br><br>        // 4. Create a new object to persist<br>//        AlienName alienName = new AlienName();<br>//        alienName.fname=&quot;Navin&quot;;<br>//        alienName.lname=&quot;Kumar&quot;;<br><br>        Alien alien = new Alien();<br>//        alien.setId(101);<br>//        alien.setName(&quot;NavinAlien&quot;);<br>//        alien.setColor(&quot;Green&quot;);<br>//<br>//         //5. Save object<br>//        session.save(alien);<br><br><br>        // 7a Fetch data<br>        alien = (Alien) session.get(Alien.class,101);<br>        System.out.println(alien);<br>        // 7. Close session1<br>        // 6. Commit transaction<br>        session.getTransaction().commit();<br>        session.close();<br><br><br>        session2.beginTransaction();<br>        alien = (Alien) session2.get(Alien.class,101);<br><br>        System.out.println(alien);<br>        session2.getTransaction().commit();<br>        session2.close();<br>        System.out.println(&quot;Alien saved successfully.&quot;);<br>    }<br>}</pre><pre>package hibernateApp;<br><br><br>import jakarta.persistence.Cacheable;<br>import jakarta.persistence.Entity;<br>import jakarta.persistence.Id;<br>import org.hibernate.annotations.Cache;<br>import org.hibernate.annotations.CacheConcurrencyStrategy;<br><br>@Entity  // Maps this class to a database table<br>@Cacheable<br>@Cache(usage = CacheConcurrencyStrategy.READ_ONLY)<br>public class Alien {<br><br>    @Id  // Primary Key annotation to map with table<br>    private int id;<br><br>    private AlienName aname;<br>    private String name;<br>    private String color;<br><br>    // Getters and Setters (required by Hibernate)<br>    public AlienName getAname() {<br>        return aname;<br>    }<br><br>    public void setAname(AlienName aname) {<br>        this.aname = aname;<br>    }<br><br>    public int getId() {<br>        return id;<br>    }<br><br>    public void setId(int id) {<br>        this.id = id;<br>    }<br><br>    public String getName() {<br>        return name;<br>    }<br><br>    public void setName(String name) {<br>        this.name = name;<br>    }<br><br>    public String getColor() {<br>        return color;<br>    }<br><br>    public void setColor(String color) {<br>        this.color = color;<br>    }<br><br>    @Override<br>    public String toString() {<br>        return this.id+&quot; : &quot;+this.name+&quot; : &quot;+this.color;<br>    }<br>}</pre><p>Caching with Hibernate<br>==============================================<br>Every session will have its own cache. If you want to share data between multiple sessions we have to go for 2nd level caching.</p><p>There are 2 levels of caching<br>Level 1 is provided by default by hibernate.<br>Level 2 we have to configure.</p><ul><li>** Requirements ***<br> — — — — — — — — — — — <br>- Include ecache dependency in pom(There are multiple provider libraries of cache like ehcache, os, swamp etc)<br>- Include hibernate-ecache dependency in pom<br>- Configure your hibernate.cfg.xml file to allow caching<br>- Add annotation to relevant class that we want to cache.<br> <a href="http://twitter.com/Cachable">@Cachable</a>: This entity is eligible for caching<br> <a href="http://twitter.com/Cache">@Cache</a>: You have to specify strategies. This will define strategy</li></ul><p>Problems that I ran due to dependencies not getting downloaded<br>===============================================================<br>I couldn’t see org.hibernate.cache.jcache.JCacheRegionFactory in any of my downloaded packages. And I kept running into below problem</p><pre>Exception in thread &quot;main&quot; org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.cache.spi.RegionFactory] due to: Unable to resolve name [org.hibernate.cache.jcache.internal.JCacheRegionFactory] as strategy [org.hibernate.cache.spi.RegionFactory]</pre><p>If you don’t see org.hibernate.cache.jcache.JCacheRegionFactory in your dependencies, it likely means:</p><p>✅ You don’t have the correct hibernate-jcache dependency for Hibernate 6-or it’s not being resolved correctly in Maven.</p><p>✅ Step-by-Step Fix<br> 1. Add the Correct Hibernate JCache Dependency<br>For Hibernate 6.6.13.Final, you need:<br><strong>&lt;dependency&gt;<br> &lt;groupId&gt;org.hibernate.orm&lt;/groupId&gt;<br> &lt;artifactId&gt;hibernate-jcache&lt;/artifactId&gt;<br> &lt;version&gt;6.6.13.Final&lt;/version&gt;<br>&lt;/dependency&gt;</strong></p><p>This module contains:</p><p>org.hibernate.cache.jcache.JCacheRegionFactory</p><p>If you used an older version like hibernate-core 5.x, it was under <strong>.internal,</strong> but in Hibernate 6+ it’s been moved to a public package (<strong>jcache</strong>, not jcache.internal).</p><p>2. Check Dependency Resolution<br>Run the following in your project directory to confirm the JAR is being downloaded:<br><strong>mvn dependency:tree | findstr hibernate-jcache</strong></p><p>You should see something like:</p><p>[INFO] +- org.hibernate.orm:hibernate-jcache:jar:6.6.13.Final:compile<br>If you don’t see it, Maven isn’t downloading it — either due to:</p><ul><li>&gt; A typo in groupId or artifactId</li><li>&gt; A corrupted local repo</li><li>&gt; A mirror misconfiguration in settings.xml</li></ul><pre>( sometimes your dependencies are trying to download from links that start with http and not HTTPS, in that case you might need to modify your settings.xml file in .m2 folder which is located at C:\Users\Your_user_name\.m2\repository)</pre><p>3. Force Maven to Redownload<br>To be sure, you can clean and re-download dependencies:</p><p><strong>mvn dependency:purge-local-repository<br>mvn clean install</strong></p><p>4. Verify the Class<br>Once downloaded, the class will be located inside:</p><p><strong>~/.m2/repository/org/hibernate/orm/hibernate-jcache/6.6.13.Final/hibernate-jcache-6.6.13.Final.jar</strong></p><p>Use a tool like IntelliJ, Eclipse, or jar tf to confirm:</p><p>jar tf hibernate-jcache-6.6.13.Final.jar | findstr JCacheRegionFactory</p><p>You should see:<br>org/hibernate/cache/jcache/JCacheRegionFactory.class</p><p>→ Final Check: Disable Cache If Not Needed<br>If you’re not actively using second-level cache, just comment out or remove these properties:</p><p><strong>&lt;property name=”hibernate.cache.use_second_level_cache”&gt;true&lt;/property&gt;<br>&lt;property name=”hibernate.cache.region.factory_class”&gt;…&lt;/property&gt;</strong></p><p>Hibernate will stop trying to load a RegionFactory, and your app will work fine.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5becb0e6ec17" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>