I'm getting Null Pointer Exception while retrieving Primary Key or Id of an Entity in Hibernate result query.   My Entity class:  @Entity @Table(name="sample") public class ccy{  @Id @column(name = "S_ID") private long id;   2nd varibale and so on   when i write hibernate query to retrieve it causes Null pointer exception, my select query is:  long ID = 0; String HQL = "select id from sample"; Query query = session.createQuery(HQL); ID = (Long)query.uniqueResult(); //getting NullPointerException in this line  return ID;   Any suggestions to avoid this exception? I'm stuck here. Any help would be much appreciated
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
This is a question that has received various answers. This questions seems simple, but it proves to be rather tricky.  So :  We flip a coin (H-T) independently $10$ times. Let's for the moment not care about whether it is fair or not.   How many $3$-head sequences are there?  Solution:  Some say that the answer is $\displaystyle\frac{10!}{7!3!}$, but this is the number of ways  by which $3$ heads can be arranged in $10$ positions. This answer , however, does not say anything about the remaining $7$ positions.   Each of these seven positions can be H or T. The total number of $7$-element sequences is $1\cdot1\cdot1\cdot2^7=2^7$. Then we have to multiply this by $\displaystyle\frac{10!}{7!3!}$ as the three heads can be anywhere. But I have found that this is not the correct answer. The correct is just $\displaystyle\frac{10!}{7!3!}$. So why not multiply by $2^7$? Finding matrix $B$ is not zero matrix where $AB= 0$ How to learn physics effectively and efficiently Subfields of $\mathbb{Q}(\sqrt{2},\sqrt{3})$ Suppose one doesn't know any Galois theory, but they are familiar with the basic theory of field extensions. Then how would one justify the following picture?    I'm pretty sure they're just saying these are the known subfields, and there could be more but they just write down those ones (which seems weird, which is why I'm asking). Or have they deduced that this is a comprehensive list of subfields just by using basic theory? This occurs on page 573 of Dummit and Foote's Abstract Algebra. I just upgraded linux-firmware package and after that I used $ sudo update-initramfs -u -k all but I got some errors:  $ sudo update-initramfs -u -k all [sudo] password for piotrek:  update-initramfs: Generating /boot/initrd.img-4.4.0-34-generic Warning: No support for locale: en_US.utf8 update-initramfs: Generating /boot/initrd.img-4.4.0-31-generic Warning: No support for locale: en_US.utf8 update-initramfs: Generating /boot/initrd.img-4.4.0-13-generic WARNING: missing /lib/modules/4.4.0-13-generic Ensure all necessary drivers are built into the linux image! depmod: ERROR: could not open directory /lib/modules/4.4.0-13-generic: No such file or directory depmod: FATAL: could not search modules: No such file or directory Warning: No support for locale: en_US.utf8 depmod: WARNING: could not open /var/tmp/mkinitramfs_LJbkti/lib/modules/4.4.0-13-generic/modules.order: No such file or directory depmod: WARNING: could not open /var/tmp/mkinitramfs_LJbkti/lib/modules/4.4.0-13-generic/modules.builtin: No such file or directory   I'm sure I don't have kernel 4.4.0-13. I might have had it some time ago but removed it:   $ apt list --installed | grep linux-  WARNING: apt does not have a stable CLI interface. Use with caution in scripts.  linux-base/xenial,xenial,now 4.0ubuntu1 all [installed,automatic] linux-firmware/now 1.159 all [installed,local] linux-headers-4.4.0-31/xenial-updates,xenial-updates,xenial-security,xenial-security,now 4.4.0-31.50 all [installed] linux-headers-4.4.0-31-generic/xenial-updates,xenial-security,now 4.4.0-31.50 amd64 [installed] linux-headers-4.4.0-34/xenial-updates,xenial-updates,xenial-security,xenial-security,now 4.4.0-34.53 all [installed] linux-headers-4.4.0-34-generic/xenial-updates,xenial-security,now 4.4.0-34.53 amd64 [installed] linux-image-4.4.0-31-generic/xenial-updates,xenial-security,now 4.4.0-31.50 amd64 [installed] linux-image-4.4.0-34-generic/xenial-updates,xenial-security,now 4.4.0-34.53 amd64 [installed] linux-image-extra-4.4.0-31-generic/xenial-updates,xenial-security,now 4.4.0-31.50 amd64 [installed] linux-image-extra-4.4.0-34-generic/xenial-updates,xenial-security,now 4.4.0-34.53 amd64 [installed] linux-libc-dev/xenial-updates,xenial-security,now 4.4.0-34.53 amd64 [installed] linux-sound-base/xenial,xenial,now 1.0.25+dfsg-0ubuntu5 all [installed] syslinux-common/xenial,xenial,now 3:6.03+dfsg-11ubuntu1 all [installed] syslinux-legacy/xenial,now 2:3.63+dfsg-2ubuntu8 amd64 [installed]   How to fix those update-initramfs errors? Do file-extensions have any purpose (for the operating system)? Projection on the hyperplane $H: \sum x_i=0$ Consider the hyperplane $H: \sum_{i=1}^n x_i=0$. Let $P$ denote the orthogonal projection onto $H$. What exactly is the matrix $P$ and how do we find it? Is it possible to change where macOS Notification Center alerts appear on the screen?  They currently appear at the top right of the screen with the menu bar:    Alerts appearing in the top right tend to cover up work I'm doing more often than not. They cover up browser tabs, toolbar icons, and window titles.  I would prefer, say, the bottom right corner of the screen.  If moving the alerts is not possible, is it possible to change the screen on which they appear? How do I connect to a MySQL Database in Python? How do I connect to a MySQL database using a python program? Is the sorting algorithm used by .NET's Array.Sort() method a  algorithm? How many Marvel Earths (Universes) are there? I know that there are at least 3 Marvel Universes:  Marvel Cinematic Universe -    Has all of the main ongoing Marvel movies    (1, 2)  (1, 2, 3)  (1, Age of Ultron) etc    Marvel's Ultimate Universe -    Has the other Marvel movies    (1, 2, 3, Origins: Wolverine, First Class, The Wolverine, Days of Future Past)  (1, 2)  etc       Main comic book continuity This is the big one, it contains         etc     Then there are apparently off-shoot Earths, continuities which deviate from the main continuity (Earth 616). How many Marvel Earths (Universes) are there?   Further Reading: How to run xrandr commands at startup in Ubuntu How can I run the following xrandrcommand on startup?  xrandr   cvt 1368 768  xrandr --newmode "1368x768_60.00"   85.25  1368 1440 1576 1784  768 771 781 798 -hsync +vsync xrandr --addmode VGA1 1368x768_60.00 xrandr --output VGA1 --mode 1368x768_60.00 Matrices $B$ that commute with every matrix commuting with $A$ There have been many questions in the vein of this one, but I can't find one that answers it specifically.     Suppose $A,B\in M_n(\mathbb C)$ are two matrices such that, for any other matrix $C\in M_n(\mathbb C)$, $$AC=CA\implies BC=CB.$$ Prove that $B=p(A)$ for a polynomial $p\in\mathbb C[t]$.    Nothing is assumed about $A$ being diagonalisable or having distinct eigenvalues or being invertible.  Edit: after further work, this might not actually be true. If it's not, a counterexample would be great. I have a Queue&lt;T&gt; object that I have initialised to a capacity of 2, but obviously that is just the capacity and it keeps expanding as I add items.  Is there already an object that automatically dequeues an item when the limit is reached, or is the best solution to create my own inherited class? Let $G$ be a locally compact Hausdorff Abelian topological group.  Let $\mu$ be a Haar measure on $G$, i.e. a regular translation invariant measure.  Let $f$ be fixed in $\mathcal{L}^1(G, \mu)$.  Define the function from $G$ to $\mathcal{L}^1(G)$ that assigns to each $y$ in $G$ the function that takes $x$ in $G$ to $f(xy^{-1})$.  I.e. it assigns the $y$-translate of $f$.  Is this a continuous function of $y$ into $\mathcal{L}^1$?      On p.94 3.10 of  it is asserted that it is.  The usual proof of this sort of thing in cases where $G=\mathbb{R}$, say, is you use density of compactly supported continuous functions, and then dominated convergence.  The former survives, but dominated convergence does not work on nets.  In fact, a limit of a net of measurable functions need not be measurable. Build a basic Python iterator Going back twice required to return to search results in the tags view This looks a little bit like a variation on  but specific to the tags view.  Reproduction (app version 1.0.71):   Select any site (say Meta) from the sidebar Switch to the tags view using the top bar Choose a tag, any tag ( is nice)   optionaly refine your search with more terms  Go to any question found, go back   you end on the unfiltered tags view  Go back again   lucky you, your search is here Why can rm remove read-only files? What is the meaning of colon (:) operator in "uint isWidget : 1;" in Qt? What is the default PATH environment variable setting on fresh install of Windows 7