Posts

Showing posts with the label jpa

springboot/jpa can't connect to mysql with username “@localhost” using password no?

springboot/jpa can't connect to mysql with username “@localhost” using password no? I'm trying to connect to MySQL database. persistent.xml <?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" version="2.1"> <persistence-unit name="myApp"> <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> <properties> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> <!-- TODO: Change file location to your H2 database ! --> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/myDB...

Spring boot jpa and ms sql update issues

Spring boot jpa and ms sql update issues I’m working on a REST web service and I want to migrate from “postgres” database and PHP (the existing web service), to microsoft sql server 2012 and spring boot. So, I have generated entities using Netbeans IDE from the existing “postgres” database. Here’s an example of a generated entity: @Entity @Table(schema = "dbo") @XmlRootElement @NamedQueries({ @NamedQuery(name = "Activite.findAll", query = "SELECT a FROM Activite a"), @NamedQuery(name = "Activite.findById", query = "SELECT a FROM Activite a WHERE a.id = :id"), @NamedQuery(name = "Activite.findByLabel", query = "SELECT a FROM Activite a WHERE a.label = :label"), @NamedQuery(name = "Activite.findByType", query = "SELECT a FROM Activite a WHERE a.type = :type"), @NamedQuery(name = "Activite.findByDateOperation", query = "SELECT a...

java.lang.IllegalArgumentException: Failed to create query method in a JpaRepository

java.lang.IllegalArgumentException: Failed to create query method in a JpaRepository I use the technologies jpa, hibernate, spring boot - data, api REST. I have the following error: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'walletRestService': Unsatisfied dependency expressed through field 'walletRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'walletRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Failed to create query method public abstract java.lang.Long com.wj.dao.WalletRepository.createWallet(java.lang.Long,java.lang.String)! No property createWallet found for type Wallet! Here is my code : Entity user: package com.wj.entities; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.persistence.Entity; import javax.persistence.FetchType; impo...