Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #27616 > unrolled thread
| Started by | Navneet Mathpal <navneetmathpal93@gmail.com> |
|---|---|
| First post | 2014-02-28 04:20 -0800 |
| Last post | 2014-02-28 04:20 -0800 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.java.programmer
how to fetchdata from data base using bean in springframework Navneet Mathpal <navneetmathpal93@gmail.com> - 2014-02-28 04:20 -0800
| From | Navneet Mathpal <navneetmathpal93@gmail.com> |
|---|---|
| Date | 2014-02-28 04:20 -0800 |
| Subject | how to fetchdata from data base using bean in springframework |
| Message-ID | <4e47367b-83af-43b6-b1c0-2144b54c3e5d@googlegroups.com> |
Hi,
I am trying to fetch the data which is in the mongodb and i am using spring framework so i have created a bean for it,
here is my config file:-
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<mongo:mongo host="10.111.10.26" port="27017" />
<mongo:db-factory dbname="yourdb" />
<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
<constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>
<bean id="TestSet" class="com.wipro.model">
</bean</beans>
and my bean class is :-
package com.wipro.model;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
@Document(collection = "TestSetTable")
public class TestSet{
@Id
String _id;
String Platform;
String Environment;
String TestSetName;
String Date;
String Relevancy;
String Recall;
String Precision;
public String get_id() {
System.out.println("came");
return _id;
}
public void set_id(String _id) {
this._id = _id;
}
public String getPlatform() {
System.out.println("came");
return Platform;
}
public void setPlatform(String platform) {
Platform = platform;
}
public String getEnvironment() {
return Environment;
}
public void setEnvironment(String environment) {
Environment = environment;
}
public String getTestSetName() {
return TestSetName;
}
public void setTestSetName(String testSetName) {
TestSetName = testSetName;
}
public String getDate() {
return Date;
}
public void setDate(String date) {
Date = date;
}
public String getRelevancy() {
return Relevancy;
}
public void setRelevancy(String relevancy) {
Relevancy = relevancy;
}
public String getRecall() {
return Recall;
}
public void setRecall(String recall) {
Recall = recall;
}
public String getPrecision() {
return Precision;
}
public void setPrecision(String precision) {
Precision = precision;
}
}
control is not cming in bean and not fetching anything explain.
Thanks & Regards
Navneet Mathapal
Back to top | Article view | comp.lang.java.programmer
csiph-web