These findings indicate that XBP1 maintains beta cell identity, represses beta-to-alpha cell transdifferentiation and is required for beta cell compensation and prevention of diabetes in insulin resistance states. This evidence concerns the gene XBP1 and diabetes mellitus.