Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In
Continue with Google
Continue with Facebook
or use


Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here
Continue with Google
Continue with Facebook
or use


Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.


Have an account? Sign In Now

Sorry, you do not have a permission to ask a question, You must login to ask question.

Continue with Google
Continue with Facebook
or use


Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Stack Ask

Stack Ask Logo Stack Ask Logo

Stack Ask Navigation

  • Home
  • About Us
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • About Us
  • Contact Us
Home/ Questions/Q 3528
Next
In Process
Hihi
  • 1
HihiTeacher
Asked: December 7, 20212021-12-07T18:32:30+00:00 2021-12-07T18:32:30+00:00In: Spring

Hỏi về Generate DDL Auto trong Spring

  • 1

Xin chào mọi nguời ,

Trong quá trình làm đồ án tốt nghiệp em có dùng tính năng tự động generate các bảng trong DB từ các entity trong Java.Và em thường hay bị mắc lỗi là để giá trị của dòng spring.jpa.hibernate.ddl-auto= create khiến cho dữ liệu trong DB bị mất hết .Đối với dữ liệu test trong đồ án của em thì việc mất mát dữ liệu thì không thành vấn đề nhưng em nghĩ đối với dự án thật thì sẽ có vấn đề rất nghiêm trọng.Cho xin phép hỏi là :

  1. Trong dự án thực tế thì người ta có sử dụng spring.jpa.hibernate.ddl-auto  không ạ ? Vì em thấy khi dùng cái này thì khả năng bị mặc lỗi và mất  mát dữ liệu cũng có % thể xảy ra.
  2. Ở dự án thức tế thì ngoài cách kiểm tra cẩn thận trước khi làm 1 việc gì đó thì có cách nào để tránh mất toàn bộ dữ liệu kiểu như trên không ạ?

Em cám ơn ạ !

hibernatespringspring data jpa
  • 5 5 Answers
  • 110 Views
  • 0 Followers
  • 0
Answer
Share
  • Facebook
  • Report

5 Answers

  • Voted
  • Oldest
  • Recent
  1. tvd12 Enlightened
    2021-12-08T05:37:13+00:00Added an answer on December 8, 2021 at 5:37 am
    This answer was edited.

    1. Trong dự án thực tế không bao giờ dùng spring.jpa.hibernate.ddl-auto em ạ
    2. Các dự án có sử dụng database đều phải phân quyền cẩn thận. Đa phần các tài khoản cấp cho code thường chỉ có chức năng insert, update, query mà không cho phép tạo bảng, xoá bảng hay delete em ạ. Ngoài ra phải có những bản backup db liên tục, tối đa phải là 7 ngày, tối thiểu có thể là 1 ngày hoặc 1 tiếng.

    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
    • Tuấn Nguyễn Beginner
      2021-12-09T16:47:39+00:00Replied to answer on December 9, 2021 at 4:47 pm

      theo e hiểu thì hình như cái này gọi là sync database với model phải không a ? nếu vậy thì khi sửa đổi db thì bên spring có tạo migration r chạy migrate như các fw khác k hay làm thế nào vậy ạ

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report
      • tvd12 Enlightened
        2021-12-11T15:21:00+00:00Replied to answer on December 11, 2021 at 3:21 pm

        1. Kiểu vậy em ạ
        2. Anh có làm 1 dự án gen code java từ database, còn lại chưa làm dự án nào mà từ code java ddl-auto ra database cả em ạ. Vì nó quá rủi ro, nếu dev vô tình code sai có thể bị mất bảng thận chí mất cả database luôn.

        • 0
        • Share
          Share
          • Share on Facebook
          • Share on Twitter
          • Share on LinkedIn
          • Share on WhatsApp
          • Report
  2. Hihi Teacher
    2021-12-08T06:26:15+00:00Added an answer on December 8, 2021 at 6:26 am

    Dạ cám ơn anh rất nhiều về câu trả lời ạ.

    Trong câu trả lời của anh có câu là “update DB liên tục…” cho em hỏi cái này theo em hiểu là backup data đúng không ạ ?

    • 0
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
    • monkey Enlightened
      2021-12-08T08:04:08+00:00Replied to answer on December 8, 2021 at 8:04 am

      Ừ, đúng rồi em ạ, anh gõ nhầm em ạ 😀

      • 0
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

You must login to add an answer.

Continue with Google
Continue with Facebook
or use


Forgot Password?

Need An Account, Sign Up Here

Sidebar

Ask A Question

Stats

  • Questions 553
  • Answers 1k
  • Best Answers 62
  • Users 290
  • Popular
  • Answers
  • monkey

    [Deep Learning] Làm thế nào để xác định được cái ...

    • 16 Answers
  • Tú Trần Anh

    [Ezyfox Server] Unity game client không gửi được command khi ...

    • 12 Answers
  • monkey

    [Go] khi nào go func được gọi?

    • 10 Answers
  • Hoàng Kiếm
    Hoàng Kiếm added an answer Huy ơi bạn đã thử login bằng command, mysql -u… May 21, 2022 at 5:42 am
  • tvd12
    tvd12 added an answer public class EzyEventLoopGroup { private final EzyRoundRobin eventLoops; private final… May 19, 2022 at 2:20 pm
  • monkey
    monkey added an answer Như vậy có nghĩa là chưa cài thành công em… May 19, 2022 at 9:17 am

Related Questions

  • monkey

    Hướng dấn sử dụng Spring Boot Test controller

    • 0 Answers
  • ptitdev

    Nhiều instance service websocket ?

    • 2 Answers
  • Hihi

    Expose API trả về kiểu Video (giống như Tiktok,..)

    • 7 Answers

Top Members

tvd12

tvd12

  • 63 Questions
  • 1k Points
Enlightened
monkey

monkey

  • 88 Questions
  • 580 Points
Enlightened
Nguyễn Thái Sơn

Nguyễn Thái Sơn

  • 140 Questions
  • 220 Points
Professional

Trending Tags

.net core abstract class analytics android ansible anti-flooding apache poi api async asyncawait atomicboolean backend backend nestjs bash script batch bean big project binding bitcoin blockchain blog british buffered build bundle c# cache caching callback career career path cast centos chat cloud cloud reliability commit company content-disposition contract cors cosmos css database datasource datastructure decentralized exchange deep learning design-pattern devops dex distraction programing docker download draw.io du học eclip editor employee english erc20 erc721 eth ethereum ethereum login extensions exyfox ezyfox ezyfox-boot ezyfox-server ezyfoxserver ezyhttp facebook fe flutter freetank french front-end frontend fullstack fulltextsearch future game game-box game-room game-server get git go golang google grapql grpc guide hazelcast hibernate hibernateconfig html http https indexing intellij interface interview io ipfs isolate issue it java javacore java core javascript java spring javaw java web job jpa js json jsp & servlet jvm jwt kafka keep promise kerberos keycloak kotlin language languague library load-balancing log log4j log4j-core login machine learning macos math maven merge messaging metamask microservice model msgpack multiple tenant multithread multithreading mysql n naming naming convention netcore netty nft nft game nio nodejs non-blocking io opensource optimize orm pagination pancakeswap panic pgpool phỏng vấn pointer postgresql pre programming promise push message android python python unicode question queue rabbitmq reactive reactjs reactjs download recyclerview redis request resource rest roadmap ropssten ropsten rust rxjava schedule search security server shift jis singleton sjis slack smart contract socket soft delete sosanh spring spring-boot-test spring-jpa spring aop springboot spring boot spring data jpa spring redis springsecurity spring security sql sql server sse stackask storage stream structure trong spring boot system environment variables thread threadjava thymeleaf totp tracking location unit test unity upload file vector view volatile vue vue cli web3 web3 client webpack websocket windows 11 winforms work zookeeper

Footer

Stack Ask

Stack Ask is where Developers Ask & Answers. It will help you resolve any questions and connect you with other people.

About Us

  • Meet The Team
  • About Us
  • Contact Us

Legal Stuff

  • Terms of Service
  • Privacy Policy
  • Cookie Policy

Help

  • Knowledge Base
  • Support

Follow

© 2021 Stack Ask. All Rights Reserved
Powered by youngmonkeys.org