Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Architecture question

Architecture question

Scheduled Pinned Locked Moved Database
databasequestionarchitecture
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    klenne
    wrote on last edited by
    #1

    Hello I want to know your opinion about the following situation. This is a situation in the database ------------------------------------- Table Address - id - street - number - cityID Table City - id - name In Code -------- Should I have an address service class that loads (using a address dal) id, street number, cityid from the address table and calls the city service (using a city dal) to load the corresponding city. Merge the results into an object and pass that around OR should the address service class load (using a address dal) to get everything back in one shot? Meaning: one stored procedure containing 'difficult' logic or two stored procedures containg very simple logic? Thnx for any response

    S M T 3 Replies Last reply
    0
    • K klenne

      Hello I want to know your opinion about the following situation. This is a situation in the database ------------------------------------- Table Address - id - street - number - cityID Table City - id - name In Code -------- Should I have an address service class that loads (using a address dal) id, street number, cityid from the address table and calls the city service (using a city dal) to load the corresponding city. Merge the results into an object and pass that around OR should the address service class load (using a address dal) to get everything back in one shot? Meaning: one stored procedure containing 'difficult' logic or two stored procedures containg very simple logic? Thnx for any response

      S Offline
      S Offline
      StylezHouse
      wrote on last edited by
      #2

      Here's my opinion... These kind of queries are what relational databases are all about. Doing a simple join in the query, instead of two database hits is WAY better. I don't think I've ever run across a case where I'd do two queries rather than a single join to get all of the data I need at the time.

      1 Reply Last reply
      0
      • K klenne

        Hello I want to know your opinion about the following situation. This is a situation in the database ------------------------------------- Table Address - id - street - number - cityID Table City - id - name In Code -------- Should I have an address service class that loads (using a address dal) id, street number, cityid from the address table and calls the city service (using a city dal) to load the corresponding city. Merge the results into an object and pass that around OR should the address service class load (using a address dal) to get everything back in one shot? Meaning: one stored procedure containing 'difficult' logic or two stored procedures containg very simple logic? Thnx for any response

        M Offline
        M Offline
        Mattias Olgerfelt
        wrote on last edited by
        #3

        Go for the one-shot. It is more effective... Give up about the entity-objects... they are useful when the colexity is very high, else use the database for what the databse is effective and good about... /Mattias

        1 Reply Last reply
        0
        • K klenne

          Hello I want to know your opinion about the following situation. This is a situation in the database ------------------------------------- Table Address - id - street - number - cityID Table City - id - name In Code -------- Should I have an address service class that loads (using a address dal) id, street number, cityid from the address table and calls the city service (using a city dal) to load the corresponding city. Merge the results into an object and pass that around OR should the address service class load (using a address dal) to get everything back in one shot? Meaning: one stored procedure containing 'difficult' logic or two stored procedures containg very simple logic? Thnx for any response

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          natural join looks betteer, but you could make a view for this...

          CREATE OR REPLACE VIEW AS
          SELECT your_columns_to_return
          FROM Address, City
          WHERE (Address.CityID = City.id);


          TOXCCT >>> GEII power
          [toxcct][VisualCalc]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups