Today's fillings are tooth-colored, composite material that is condensed inside the area(s) of a tooth which used to be a cavity, or a previous filling.
Once finished and hardened with a special dental curing light, the fillings are ready to be shaped and polished. When a patient leaves the office, this type of composite filling is as hard as they are going to get and, after the anesthesia has worn-off, the patient can eat on them immediately, without concern for fracture or breakage.
Fillings are terrific restoration for small, moderate, and sometimes even moderate-to-severe sized cavities, or fractures, depending on where the damage is located in the tooth.
These composite fillings actually "bond" to the tooth through a mechanism known as micromechanical retention. This is accomplished by the use of an acid gel on your teeth, which slightly demineralizes the area the filling will be placed.
This provides thousands, to tens-of-thousands, of small nooks-and-crannies for the composite material to attach to both chemically and mechanically.
Other substances called primers and bonding agents are used to provide the chemical attachment, which allows each subsequent layer of material to actually chemically attach to the tooth, then to the next level material. It's quite amazing actually, and looks terrific, while lasting as long as the previous amalgam fillings (AKA: Mercury fillings). There is no mercury in these new fillings, just all space-age materials that are in use today in many industries, including the aerospace industry.
These composite fillings are technique sensitive, much more so than amalgam fillings, so they must be placed in a very exacting way. Any saliva, or water, that comes in contact with the fillings as they are being placed will cause them to fail prematurely; this is called contamination. So, the Dentist will probably place a rubber dam, or a large amount of cotton rolls, into your mouth when performing this procedure. This is normal, and necessary for a good outcome. Once the curing light has been used on the filling material it is watertight and safe for use in the mouth.