永发信息网

mybatis environment的id可以随便命名的吗

答案:2  悬赏:20  手机版
解决时间 2021-02-03 16:38
  • 提问者网友:留有余香
  • 2021-02-03 04:36
mybatis environment的id可以随便命名的吗
最佳答案
  • 五星知识达人网友:拾荒鲤
  • 2021-02-03 05:07
你好
  • 其实不可以的,这个命名空间与映射文件中的 statements 中配置的 SQL 语句的 id 有关。
  • 在大型项目中,可能存在大量的 SQL 语句,这时候,为每个 SQL 语句起一个唯一的标识 id 就变得并不容易了。为了解决这个问题,在 mybatis 中,可以为每个映射文件起一个唯一的命名空间,这样,定义在这个映射文件中的每个 SQL 语句就成了定义在这个命名空间中的一个 id。只要我们能够保证每个命名空间是唯一的,即使在不同映射文件中的语句的 id 相同,也就不会冲突了。
  • 与 C# 不同的是,这个通过命名空间管理语句标识的机制默认并不启用,也就是说,默认并不考虑我们定义的命名空间,而是直接使用语句的 id 。
    希望对你有帮助
  • 全部回答
    • 1楼网友:老鼠爱大米
    • 2021-02-03 06:45
    we live in the world every day. we eat food, drink water, wear clothes, watch tv, use computers and so on. we are producing waste every moment. generally speaking, there are four sorts of waste. they are material waste, organic waste, inorganic waste and poisonous & harmful waste. now, we are going to talk about each sort of waste one by one. material waste: it means the waste of substance or things from which something else can be made. for example, people throw away the used metal products and buy a new one, so the old metal waste accumulates. at last, they become waste. for example, when people finish reading newspaper, the paper will become waste. when the glass is broken, it also becomes waste. nobody wants to use a broken window or drink with a broken glass or wear a pair of broken glasses. once it is broken, it becomes waste. the rate of using plastics is increasing day by day. people use plastic bags because they are convenient. when they get home, they throw the plastics way, paying no attention to the environment. the more convenience plastics brings to us, the more plastic waste is produced. this is called “white pollution” as most plastics are white. some of our products we use every day are made of rubber, just like the tyres and the bottom part of our shoes. it’s true that rubber plays an important role in our life. however, it also brings us some trouble when it has been used for a long time and becomes old. the old tyres become waste because it can’t break down by nature. this is really a big problem. organic waste: it refers to waste from living things, including waste from animals, plants and people. some parts of vegetables are thrown away as waste because they don’t taste good. in the past, people cooked their food using burning coal, so there left the burned coal, which is useless, like the thrown vegetables. all this sorts of waste contain organism, so it is called organic waste. actually, we also have inorganic waste, the opposite to organic waste, including building waste, broken pottery and china, and cinder. the last part is harmful and poisonous waste, such as used batteries, electrical apparatus and medical supplies. computers and tv sets are one part of electrical apparatus. you see, the old electrical apparatus can set off some dangerous rays and make the soil harder, even damage the under ground water. mobile phones are as dangerous as computers and tv sets. as we know, x-rays can be used to examine patients, but the x-rays machines are dangerous when they are thrown away without any treatment. they can’t be used to treat the sick, but they still can give off rays. for the normal people, they can be dangerous. so, we must think about this problem. as waste has four sorts, we can sort them into each sort that they belong to. it’s convenient to treat them after they are sorted. then we can deal with them sort by sort. we have thought out some methods like storing them in order to change them into plant food, or burning them in a huge stove and use the heat to make electricity. for the first way, the change rate is much too low and it may pollute the under ground water. for the second one, of course it’s wonderful if it’s easy to be tried out. but to build such a huge stove will cost too much. not a good method. now you see, treating waste is not an easy job. from what has been discussed above, we can do something to our home—the earth. we should make full use of things. at the same time, we’d better reduce its harmful effect as much as possible. we can do from the basic of waste. that’s to say, we can reduce the production of waste, and reuse and recycle them as much as we can. take material waste for example. nearly all of them can be recycled and reused. and, we should call for using things made of paper instead of plastics so as to protect our environment. protecting the environment is not one person’s duty; it depends on all of us. what can we do? maybe a dozen.. in a word, use what can reuse as much as possible. remember, environment protection is not one’s duty!
    我要举报
    如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
    点此我要举报以上问答信息
    大家都在看
    推荐资讯