Using the @repository interface provided by Springboot, you can accomplish the custom work that once required a lot of code writing and configuration files. These configurations, which previously gave novice programmers a headache and were proud of an experienced programmer, have become less important due to the continuous improvement of the framework and have also improved programmer productivity. This article describes how to manipulate MongoDB thro
Here is an article that is very clear: Spring boot multi-data source configuration and useHeterogeneous database multi-source supportFor example, in our project, we need support for MySQL, as well as a query for MongoDB.Entity classes declare @Entity relational database support types, declared @Document as MongoDB
Spring Boot is a further encapsulation of spring, designed to simplify the installation and configuration of spring. We know that using spring to build a project environment often involves referencing many jar packages and creating a lot of XML files as the business becomes
, adhere to the principle of diversification, choose a better and more economical way, rather than top-down unification. More commonly, we can directly use MongoDB to store key value pairs of data types, such as: Verification Code, session, etc. due to MongoDB's scale-out capability, it can also be used to store data that is very large in the future, such as: logs, comments, etc. Because MongoDB stores the
MongoDB is used in the Spring boot project, and when MongoDB is not manipulated for a while, the next time you manipulate MongoDB there will be an exception. Exceptions are as follows:
org.springframework.data.mongodb.UncategorizedMongoDbException: Prematurely reached
Tags:%s inter 14. ATI PAT Test Boot ABC System1. functionUse spring to link mongodb, and make additional deletions and checks2. Class structure diagram3. ImplementCode structure Entity #userentity Packagecom.jihite.entity; Public classuserentity {Private intID; PrivateString name; PrivateString passwd; Public intgetId () {returnID; }
Public voidSetId (i
Using the @repository interface provided by Springboot, you can accomplish the custom work that once required a lot of code writing and configuration files. These configurations, which previously gave novice programmers a headache and were proud of an experienced programmer, have become less important due to the continuous improvement of the framework and have also improved programmer productivity.This article describes how to manipulate MongoDB throu
,"cityname": "温岭","description": "温岭是个好城市"}}The following verify the implementation of the weighted sub-query Search interface: GET http://localhost:8080/api/city/search?pageNumber=0pageSize=10searchContent= wenlingThe data will appear[{"id": 1,"provinceid": 1,"cityname": "温岭","description": "温岭是个好城市"},{"id": 2,"provinceid": 2,"cityname": "温州","description": "温州是个热城市"}]From the background Console can be seen, print out the corresponding DSL statement:
As for the MongoDB web has a lot of relevant information, so there is not too much to introduce here, we are here mainly to introduce how to use MongoDB and spring boot combination. This section outlines:
(1) Preparatory work;
(2) Create a new MAVEN Java project;
(3) to introduce relevant dependence;
(4) write the test
());} /** According to the settings of shared or not, Spring creates a ehcache base by Cachemanager.create () or new CacheManager () respectively. */@Bean PublicEhcachemanagerfactorybean Ehcachemanagerfactorybean () {Ehcachemanagerfactorybean CacheManagerFactoryBean=NewEhcachemanagerfactorybean (); Cachemanagerfactorybean.setconfiglocation (NewClasspathresource ("Ehcache.xml")); Cachemanagerfactorybean.setshared (true); returnCachemanagerfactorybean;
Com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList (Sqlstatementparser.java:83) at Com.alibaba.druid.wall.WallProvider.checkInternal (Wallprovider.java:624) at Com.alibaba.druid.wall.WallProvider.check (Wallprovider.java:578) at Com.alibaba.druid.wall.WallFilter.checkInternal (Wallfilter.java:785) ... 101 MoreView CodeThe Mapper.xml mapping file is as follows:Select ID= "Findbynameandpersonandcreatedate"ParameterType= "Com.sxd.swapping.domain.HuaYangArea"Resulttype= "Com.sxd.
Because 3.0.3,mongodb joins the Scram-sha-1 checksum, a third-party tool is required to verify that a user authentication failure occurs when all spring boot is connected to MongoDB.Workaround:>Use Admin switched to DB admin>varSchema = Db.system.version.findOne ({"_id":"Authschema"}) > schema.currentversion =3 3>Db.system.version.save (Schema) Writeresult ({"nma
reg2.reg_id = rec.rec_cityLeft outer joins Cw_region as reg3 on reg3.reg_id = Rec.rec_townLeft outer join Cw_company as COM on com.com_id = rec.com_idLeft outer join Cw_recres as RRS on rrs.rec_id = rec.rec_idLeft OUTER join Cw_resume as res on res.res_id = rrs.res_idLeft OUTER join Cw_rectre as RCS on rcs.rec_id = rec.rec_idLeft outer joins Cw_treatment as tre on tre.tre_id = rcs.tre_idLimit #{begin}, #{pagesize}The results are as follows:recruitentity{Recid=1,Recname= ' Anme ',Positionentity=
In the "Spring boot, using JPA operations SQL Server database completion crud", based on spring boot, using JPA to invoke the SQL Server database's stored procedure and return the records collection, completed the crud and called the stored procedure query data.In many compl
@DBref The document association, when queried by that type, add the field name of the associated table to the field name, as follows:Criteria.where ("BlogGroup. $id"),$id represents the OID field of the associated table.OR and and union queriessuch as the query (a = 1 and b = 2) or (A = 3 and b =4), or the number of uncertainties,Then a criteria array is defined, the condition group is entered into the array, and the array is assigned to the Orcriteri
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.