Geting Current logged user details for jhi_persistenet_audit_event tableHow to select the nth row in a SQL database table?MyISAM versus InnoDBMySQL Error 1093 - Can't specify target table for update in FROM clauseHow do I restore a dump file from mysqldump?How to get a list of user accounts using the command line in MySQL?MySQL: Large VARCHAR vs. TEXT?How to shrink/purge ibdata1 file in MySQLGrant **all** privileges on databaseSQL query return data from multiple tablesHow to import an SQL file using the command line in MySQL?

What could a self-sustaining lunar colony slowly lose that would ultimately prove fatal?

Which European Languages are not Indo-European?

Why does Mjolnir fall down in Age of Ultron but not in Endgame?

In general, would I need to season a meat when making a sauce?

Is there an online tool which supports shared writing?

Have 1.5% of all nuclear reactors ever built melted down?

Teacher help me explain this to my students

How to get Data from Rasperry to Arduino?

Pirate democracy at its finest

Is Jon Snow the last of his House?

Need to understand my home electrical meter to see why bill is so high and/or if neighbor is on same meter

How should I introduce map drawing to my players?

How do I partition a matrx into blocks and replace zeros with dots?

Using credit/debit card details vs swiping a card in a payment (credit card) terminal

Leaching of copper using zinc

My employer faked my resume to acquire projects

Where's this lookout in Nova Scotia?

Is the Indo-European language family made up?

How to deal with a colleague who is being aggressive?

Should breaking down something like a door be adjudicated as an attempt to beat its AC and HP, or as an ability check against a set DC?

Gladys goes shopping

Realizing cohomology classes by submanifolds

Best material to absorb as much light as possible

Construct a word ladder



Geting Current logged user details for jhi_persistenet_audit_event table


How to select the nth row in a SQL database table?MyISAM versus InnoDBMySQL Error 1093 - Can't specify target table for update in FROM clauseHow do I restore a dump file from mysqldump?How to get a list of user accounts using the command line in MySQL?MySQL: Large VARCHAR vs. TEXT?How to shrink/purge ibdata1 file in MySQLGrant **all** privileges on databaseSQL query return data from multiple tablesHow to import an SQL file using the command line in MySQL?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am working with jhipster. I need to create a new table for auditing my database changes and link it with the default jhi_persistenet_audit_event table generated by the Jhipster. How I can get the current logged user record from the jhi_persistenet_audit_event table to link that id to my new table?










share|improve this question




























    0















    I am working with jhipster. I need to create a new table for auditing my database changes and link it with the default jhi_persistenet_audit_event table generated by the Jhipster. How I can get the current logged user record from the jhi_persistenet_audit_event table to link that id to my new table?










    share|improve this question
























      0












      0








      0








      I am working with jhipster. I need to create a new table for auditing my database changes and link it with the default jhi_persistenet_audit_event table generated by the Jhipster. How I can get the current logged user record from the jhi_persistenet_audit_event table to link that id to my new table?










      share|improve this question














      I am working with jhipster. I need to create a new table for auditing my database changes and link it with the default jhi_persistenet_audit_event table generated by the Jhipster. How I can get the current logged user record from the jhi_persistenet_audit_event table to link that id to my new table?







      mysql spring-boot jhipster






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 24 at 3:41









      akalankaakalanka

      32




      32






















          1 Answer
          1






          active

          oldest

          votes


















          1















          Solution 1: Principal principal




           @RequestMapping(value = "/", "")
          public String start(Principal principal, Model model)
          String currentUser = principal.getName();
          return currentUser;





          Solution 2: Authentication authentication




          @RequestMapping(value = "/", "")
          public String currentUserName(Authentication authentication)
          return authentication.getName();





          Solution 3: SecurityContextHolder




          Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
          if (principal instanceof UserDetails)
          String username = ((UserDetails)principal).getUsername();
          else
          String username = principal.toString();



          Details 1 Details 2






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320534%2fgeting-current-logged-user-details-for-jhi-persistenet-audit-event-table%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1















            Solution 1: Principal principal




             @RequestMapping(value = "/", "")
            public String start(Principal principal, Model model)
            String currentUser = principal.getName();
            return currentUser;





            Solution 2: Authentication authentication




            @RequestMapping(value = "/", "")
            public String currentUserName(Authentication authentication)
            return authentication.getName();





            Solution 3: SecurityContextHolder




            Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
            if (principal instanceof UserDetails)
            String username = ((UserDetails)principal).getUsername();
            else
            String username = principal.toString();



            Details 1 Details 2






            share|improve this answer



























              1















              Solution 1: Principal principal




               @RequestMapping(value = "/", "")
              public String start(Principal principal, Model model)
              String currentUser = principal.getName();
              return currentUser;





              Solution 2: Authentication authentication




              @RequestMapping(value = "/", "")
              public String currentUserName(Authentication authentication)
              return authentication.getName();





              Solution 3: SecurityContextHolder




              Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
              if (principal instanceof UserDetails)
              String username = ((UserDetails)principal).getUsername();
              else
              String username = principal.toString();



              Details 1 Details 2






              share|improve this answer

























                1












                1








                1








                Solution 1: Principal principal




                 @RequestMapping(value = "/", "")
                public String start(Principal principal, Model model)
                String currentUser = principal.getName();
                return currentUser;





                Solution 2: Authentication authentication




                @RequestMapping(value = "/", "")
                public String currentUserName(Authentication authentication)
                return authentication.getName();





                Solution 3: SecurityContextHolder




                Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
                if (principal instanceof UserDetails)
                String username = ((UserDetails)principal).getUsername();
                else
                String username = principal.toString();



                Details 1 Details 2






                share|improve this answer














                Solution 1: Principal principal




                 @RequestMapping(value = "/", "")
                public String start(Principal principal, Model model)
                String currentUser = principal.getName();
                return currentUser;





                Solution 2: Authentication authentication




                @RequestMapping(value = "/", "")
                public String currentUserName(Authentication authentication)
                return authentication.getName();





                Solution 3: SecurityContextHolder




                Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
                if (principal instanceof UserDetails)
                String username = ((UserDetails)principal).getUsername();
                else
                String username = principal.toString();



                Details 1 Details 2







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 24 at 5:11









                Patel RomilPatel Romil

                878415




                878415





























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320534%2fgeting-current-logged-user-details-for-jhi-persistenet-audit-event-table%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

                    밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

                    1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴