I develop application with Google App Engine and Google Cloud SQL I am writing data in to Google Cloud SQL in Hebrew the data is written as "????" how can I transform it to UTF-8 Thank you
example of entity
package com.darimpo.shared.entities;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import com.darimpo.shared.utilities.Utilities.Parameters;
@Entity
@Table(name = "AddressesTable")
public class Address extends Base {
private long buildingId;
private long floorId;
private long apartmentId;
private long userId;
@Transient
private String floorName;
@Transient
private String apartmentName;
public Address() {
}
public Address(long buildingId) {
setBuildingId(buildingId);
}
public Address(long buildingId,long floorId) {
this(buildingId);
setFloorId(floorId);
}
public Address(long buildingId,long floorId,long longId) {
this(buildingId,floorId);
setApartmentId(apartmentId);
}
public Address(Parameters parameters) {
super(parameters);
setUserId(parameters.getLong(USER_ID));
setBuildingId(parameters.getLong(BUILDING_ID));
setFloorId(parameters.getLong(FLOOR_ID));
setApartmentId(parameters.getLong(APARTMENT_ID));
setFloorName(parameters.getString(FLOOR_NAME));
setApartmentName(parameters.getString(APARTMENT_NAME));
}
@Override
protected void onCopy(Base source) {
super.onCopy(source);
if(source instanceof Address){
Address address = (Address)source;
setBuildingId(address.getBuildingId());
setFloorId(address.getFloorId());
setApartmentId(address.getApartmentId());
setFloorName(address.getFloorName());
setApartmentName(address.getApartmentName());
}
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
public long getBuildingId() {
return buildingId;
}
public void setBuildingId(long buildingId) {
this.buildingId = buildingId;
}
public long getFloorId() {
return floorId;
}
public void setFloorId(long floorId) {
this.floorId = floorId;
}
public long getApartmentId() {
return apartmentId;
}
public void setApartmentId(long apartmentId) {
this.apartmentId = apartmentId;
}
public String getFloorName() {
return floorName;
}
public void setFloorName(String floorName) {
this.floorName = floorName;
}
public String getApartmentName() {
return apartmentName;
}
public void setApartmentName(String apartmentName) {
this.apartmentName = apartmentName;
}
public boolean isFullAddress() {
return buildingId != NO_ID && floorId != NO_ID && apartmentId != NO_ID;
}
@Override
public boolean equals(Object obj) {
if(obj instanceof Address){
Address address = (Address)obj;
if(getUserId() == address.getUserId()){
return getBuildingId() == address.getBuildingId() &&
getFloorId() == address.getFloorId() &&
getApartmentId() == address.getApartmentId();
}
}
return super.equals(obj);
}
public static final String BUILDING_ID = "buildingId";
public static final String USER_ID = "userId";
public static final String FLOOR_ID = "floorId";
public static final String APARTMENT_ID = "apartmentId";
public static final String FLOOR_NAME = "floorName";
public static final String APARTMENT_NAME = "apartmentName";
}
example of how I insert entity
public Base insert(Base base){
EntityManager em = entityManagerFactory.createEntityManager();
try{
em.getTransaction().begin();
base.setLastUpdated(getCoreServer().getTimeManager().getCurrentTime().getTime());
em.persist(base);
em.getTransaction().commit();
return base;
}
finally{
em.close();
}
}
example of how I select entity
public Object select(DarimpoQuery selectQuery){
EntityManager em = entityManagerFactory.createEntityManager();
try{
em.getTransaction().begin();
Query query =
em.createQuery(selectQuery.createSelectQuery());
addParametersQuery(selectQuery, query);
}
Object result = query.getResultList();
if(selectQuery.isSingleResult() && result instanceof List){
List<Object> results = (List)result;
return results.isEmpty() ? null : results.get(0);
}
return result;
}finally{
em.close();
}
}
After selecting an entity from dataBase I get the String as "????"
you can see how entity saved in dataBase on this link https://drive.google.com/open?id=0B5FQ_6n1BT1EUnVFVFJsRFlyVTg again thank you