Wednesday, 8 June 2016

not-null property references a null or transient value

org.springframework.dao.DataIntegrityViolationException: not-null property references a null or transient value : entity.VoiceProfile.email; nested exception is org.hibernate.PropertyValueException: not-null property references a null or transient value : entity.voiceProfile.email

 conclustion :
 While persisting into the DB get the users VoicePofile by id or check if any user exist for the voiceprofile or not.
 if exist get and then store in db.

Tuesday, 7 June 2016

com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column ' ' cannot be null

Let us check scenario of hibernate.
solution :
1.check entity  mapping with table.
2. check the primary key and foreign key relationship.
3. primary key cannot be "not null" in table, it can be null in other table. 

Monday, 6 June 2016

com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException

com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException

SEVERE: The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container

com.fasterxml.jackson.core.JsonParseException: Unexpected character ('"' (code 34)): was expecting comma to separate OBJECT entries

Ex :
error :
{
"name" : "voice"
"email" : "voice@gmail.com"

}
corrected :
{
"name" : "voice" ,
"email" : "voice@gmail.com"

}

Solution :  In the corrected solution put a comma.

Thursday, 2 June 2016

error: failed to push some refs to git

error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/userid/voice.git'

solution :
1. git add -A
2. git status
3. git commit -m "message"
3.git push origin HEAD:<remoteBranch>

Thursday, 26 May 2016

Functional style in java.

Functional style in java.

Function<T,R> function = new  Function<T,R>();
Type Parameters:
T - the type of the input to the function
R - the type of the result of the function

Ref : Oracle

ex :
It is the explicit intent to make it more convenient to program in a functional style in Java. Now, in mathematics, a function is generally written like

f: A -> B
(i.e., a function from As to Bs). This corresponds also to the notation in functional languages, Scala and already existing functional libraries for Java.

Ref : Stackoverflow 

Tuesday, 24 May 2016

WARN (SqlExceptionHelper.java:233) - Unknown column 'xxx' in 'field list'

 WARN  (SqlExceptionHelper.java:233) - Unknown column 'EditedOn' in 'field list'

Solution :
1) In hibernate check the entity class.
2) In table check the column names.
3) Compare both the entity and column name.
4.Caused due to spelling mistake.

Saturday, 21 May 2016

scope of public,private,protected in java for class method

public : method which are public there scope is available to child and which ever class wants to use it.
protected : scope visible only in child package
private :  scope visible only in class.