app/models/Posts.java
public Map<String, Long> createPostWithRawQuery(Long userId, String description) {
		Map<String, Long> response = null;
		Ebean.beginTransaction();
		
		try{
			String query = "INSERT INTO posts (user_id,post_description,created_date) VALUES(:user_id,:post_description,:created_date)";
			SqlUpdate insertPost = Ebean.createSqlUpdate(query);
			insertPost.setParameter("user_id", userId).setParameter("post_description", description.trim())
			.setParameter("created_date", new Date().getTime());
			int rows = Ebean.execute(insertPost);
			
			if(rows > 0){
				response = new HashMap<String, Long>();
				SqlRow latestPost = findPostByUserIdDescriptionRawQuery(userId,description);
				response.put(ApiResponseKeys.POST_ID.toString(), latestPost.getLong(ApiResponseKeys.DB_ID.toString())); 
			}
			Ebean.commitTransaction();
		} finally {
			if (Ebean.currentTransaction() != null) {
				Ebean.currentTransaction().rollback();
			}
		}
	
		
		return response;
	}
/**
	 * Creates Posts By user in session
	 * @param userId
	 * @param description
	 * @return
	 */
Creates Posts By user in session
@param userId
@param description
@return
Creates Posts By user in session @param userId @param description @return
public Map<String, Long> createPostWithRawQuery(Long userId, String description) {
		Map<String, Long> response = null;
		Ebean.beginTransaction();
		try{
			String query = "INSERT INTO posts (user_id,post_description,created_date) VALUES(:user_id,:post_description,:created_date)";
			SqlUpdate insertPost = Ebean.createSqlUpdate(query);
			insertPost.setParameter("user_id", userId).setParameter("post_description", description.trim())
			.setParameter("created_date", new Date().getTime());
			int rows = Ebean.execute(insertPost);
			if(rows > 0){
				response = new HashMap<String, Long>();
				SqlRow latestPost = findPostByUserIdDescriptionRawQuery(userId,description);
				response.put(ApiResponseKeys.POST_ID.toString(), latestPost.getLong(ApiResponseKeys.DB_ID.toString())); 
			}
			Ebean.commitTransaction();
		} finally {
			if (Ebean.currentTransaction() != null) {
				Ebean.currentTransaction().rollback();
			}
		}
		return response;
	}
public Map < String , Long > createPostWithRawQuery ( Long userId , String description ) { Map < String , Long > response = null ; Ebean . beginTransaction ( ) ; try { String query = "INSERT INTO posts (user_id,post_description,created_date) VALUES(:user_id,:post_description,:created_date)" ; SqlUpdate insertPost = Ebean . createSqlUpdate ( query ) ; insertPost . setParameter ( "user_id" , userId ) . setParameter ( "post_description" , description . trim ( ) ) . setParameter ( "created_date" , new Date ( ) . getTime ( ) ) ; int rows = Ebean . execute ( insertPost ) ; if ( rows > 0 ) { response = new HashMap < String , Long > ( ) ; SqlRow latestPost = findPostByUserIdDescriptionRawQuery ( userId , description ) ; response . put ( ApiResponseKeys . POST_ID . toString ( ) , latestPost . getLong ( ApiResponseKeys . DB_ID . toString ( ) ) ) ; } Ebean . commitTransaction ( ) ; } finally { if ( Ebean . currentTransaction ( ) != null ) { Ebean . currentTransaction ( ) . rollback ( ) ; } } return response ; }
Creates Posts By user in session
 @param userId
 @param description
 @return
Creates Posts By user in session @param userId @param description @return